Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > regex to match similar strings

Reply
Thread Tools

regex to match similar strings

 
 
John Butler
Guest
Posts: n/a
 
      07-12-2010
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/.

 
Reply With Quote
 
 
 
 
chris williams
Guest
Posts: n/a
 
      07-12-2010

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: http://www.velocityreviews.com/forums/(E-Mail Removed)
> Subject: regex to match similar strings
> To: (E-Mail Removed)
>=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=

 
Reply With Quote
 
 
 
 
John Butler
Guest
Posts: n/a
 
      07-12-2010
Thanks Chris, exactly what i needed. Installed the amatch gem and have
it running now,

http://flori.github.com/amatch/doc/A...venshtein.html

JB
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to escape # hash character in regex match strings 504crank@gmail.com Python 8 06-14-2009 07:48 AM
Any similar Webcam broadcasting site similar to youtube Chaudhry Nijjhar Computer Support 0 02-19-2008 11:48 PM
regex to match strings that don't contain any digits? Dave Perl Misc 8 08-10-2005 08:10 AM
Regex - disincluding strings in a match Steve Chiang Perl Misc 8 05-28-2005 02:17 AM
Java regex can't match lengthy match? hiwa Java 0 01-29-2004 10:09 AM



Advertisments