in reply to Reverse regexp a regexp?
output: (?-xism:http:\/\/www\.youtube\.com\/user\/test[12345])#! /usr/bin/perl use strict; use warnings; use Regexp::Assemble; my @urls = qw( http://www.youtube.com/user/test1 http://www.youtube.com/user/test2 http://www.youtube.com/user/test3 http://www.youtube.com/user/test4 http://www.youtube.com/user/test5 ); my $r = Regexp::Assemble->new; for (@urls) { $r->add( quotemeta ); } print $r->re, $/; __END__
And you may also find valuable the String-Approx distribution from CPAN which implements approximate string matching based on Levenshtein distance.
Hope this helps.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Reverse regexp a regexp?
by freakingwildchild (Scribe) on Feb 13, 2010 at 23:09 UTC |