From: Robert Dober Date: 2006-04-07T02:16:44+09:00 Subject: Re: String generalization ------=_Part_7750_10771363.1144343800108 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 4/6/06, Dominik Bathon wrote: > > [SNIP] > > > The part that finds the repeating patterns is a bit ugly, but it should > work. Here are the results: > > $ ruby generalize_rx.rb > 12345 =3D> /\d+/ > ABCDE =3D> /[A-Z]+/ > john.smith@my.super.server.rb =3D> /[a-z]+\.[a-z]+@([a-z]+\.)+[a-z]+/ > 123-45-678-90 =3D> /(\d+\-)+\d+/ > item: =3D> /[a-z]+:/ > Peter, SZINEK =3D> /\w+,\ [A-Z]+/ > http://www.google.com =3D> /[a-z]+:\/\/([a-z]+\.)+[a-z]+/ > jd=A3;d:L348kddd3 =3D> /[a-z]+\243;[a-z]:\w+/ Well that is quite impressive, but I could not figure out why "12a".you_know_the_name_of_the_method gives /\w+/, it clearly should give /\d+[a-z]+/, no? Cheers Robert Dominik > > -- Deux choses sont infinies : l'univers et la b=EAtise humaine ; en ce qui concerne l'univers, je n'en ai pas acquis la certitude absolue. - Albert Einstein ------=_Part_7750_10771363.1144343800108--