regex to match similar strings

Discussion in 'Ruby' started by John Butler, Jul 12, 2010.

  1. John Butler

    John Butler Guest

    Hi,

    Im writing some validation code the basically make sure a users login is
    not too similar to their password. I was thinking a regular expression
    to match similarities and if they are alike then make the user change
    their password.

    This doesnt have to be bullet proof just enough to really say if
    someones username is bobbysmith then their password cant be bobbysmith7
    or bobbysmi7

    Anyone got a solution, is it possible to do this with a regular
    expression or will it be some ruby code ina loop....

    JB
    --
    Posted via http://www.ruby-forum.com/.
    John Butler, Jul 12, 2010
    #1
    1. Advertising

  2. Here are a couple ruby libraries that may help you out. I found this a whi=
    le back on a ruby sitewhen I was looking to compare strings for duplicates =
    when cleansing data.
    The first is distance between strings. (I prefer this one)
    The second is the traditional soundex Remove vowels take the first letter =
    run a calc on the rest.Its not very reliable but may help.
    The third is like soundex but larger strings.
    http://raa.ruby-lang.org/project/levenshtein/=20
    http://raa.ruby-lang.org/project/soundex/=20
    http://raa.ruby-lang.org/project/metaphone/=20
    Here is the link to the original post:http://groups.google.com/group/comp.l=
    ang.ruby/browse_thread/thread/1276ccf14b3d6ca6/3750d67dc7b2f496?lnk=3Dgst&q=
    =3Ddouble+metaphone&pli=3D1

    > Date: Tue=2C 13 Jul 2010 05:56:00 +0900
    > From:
    > Subject: regex to match similar strings
    > To:
    >=20
    > Hi=2C
    >=20
    > Im writing some validation code the basically make sure a users login is
    > not too similar to their password. I was thinking a regular expression
    > to match similarities and if they are alike then make the user change
    > their password.
    >=20
    > This doesnt have to be bullet proof just enough to really say if
    > someones username is bobbysmith then their password cant be bobbysmith7
    > or bobbysmi7
    >=20
    > Anyone got a solution=2C is it possible to do this with a regular
    > expression or will it be some ruby code ina loop....
    >=20
    > JB
    > --=20
    > Posted via http://www.ruby-forum.com/.
    >=20

    =20
    _________________________________________________________________
    Game on: Challenge friends to great games on Messenger
    http://go.microsoft.com/?linkid=3D9734387=
    chris williams, Jul 12, 2010
    #2
    1. Advertising

  3. John Butler

    John Butler Guest

    John Butler, Jul 12, 2010
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. hiwa
    Replies:
    0
    Views:
    627
  2. Replies:
    8
    Views:
    2,648
    Lie Ryan
    Jun 14, 2009
  3. Steve Chiang

    Regex - disincluding strings in a match

    Steve Chiang, May 27, 2005, in forum: Perl Misc
    Replies:
    8
    Views:
    156
    Eric Amick
    May 28, 2005
  4. Dave
    Replies:
    8
    Views:
    144
    Dave Weaver
    Aug 10, 2005
  5. Replies:
    1
    Views:
    330
    Tad J McClellan
    Feb 11, 2008
Loading...

Share This Page