There's more than one way to do things | |
PerlMonks |
Re^2: Reverse regexp a regexp?by freakingwildchild (Scribe) |
on Feb 12, 2010 at 19:52 UTC ( [id://822922]=note: print w/replies, xml ) | Need Help?? |
This is possible by converting a regex into some sort of finite automaton and doing a traversal on it. Perl would be my prefered choice in this though. The use of such would be great in creating examples in how regexes get processed. This problem is a bit underspecified. For example, if you give me any sample of, say, 10 URLs
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:
http://be.apple.itunes.com/blabla/blabla/id/1543285432 http://us.apple.itunes.com/blabla/blabla/id/154328545 http://uk.apple.itunes.com/blabla/blabla/id/5532424342 http://be.apple.itunes.com/blabla/blabla/id/15432
http://be.apple.itunes.com/blabla/id/4324
In Section
Seekers of Perl Wisdom
|
|