Welcome to the Monastery | |
PerlMonks |
Re: how can i split a string to an array and convert it into regular expressionby mwah (Hermit) |
on Dec 08, 2007 at 20:13 UTC ( [id://655876]=note: print w/replies, xml ) | Need Help?? |
i want to split it into an array becoz i want to convert the user input into regular expression with some loops You don't need to split into an array of characters for performing the task you described. The "program" you'll need looks probably like:
Perl is really good at finding strings that match a given regular expression, but rather bad at finding regular expressions that *would match* given strings 'optimally'. The remaining task for you is therefore to enter your favorite algorithm to do that between the curly braces of the subroutine 'transform_string_to_optimal_matching_regex()':
This is really an interesting thing to do. Maybe there are some approaches already published (none of which I know from). Regards mwa
In Section
Seekers of Perl Wisdom
|
|