------ art_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 <dbatml / gmx.de> 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 => /\d+/ > ABCDE => /[A-Z]+/ > john.smith / my.super.server.rb => /[a-z]+\.[a-z]+@([a-z]+\.)+[a-z]+/ > 123-45-678-90 => /(\d+\-)+\d+/ > item: => /[a-z]+:/ > Peter, SZINEK => /\w+,\ [A-Z]+/ > http://www.google.com => /[a-z]+:\/\/([a-z]+\.)+[a-z]+/ > jdd:L348kddd3 => /[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óŐise humaine ; en ce qui concerne l'univers, je n'en ai pas acquis la certitude absolue. - Albert Einstein ------ art_7750_10771363.1144343800108--