Xiong has asked for the wisdom of the Perl Monks concerning the following question:
Given:
my $left_text = [ qw{ when rome romans} ]; my $right_text = 'When in Rome, do as the Romans.'; # generate $regex and $flags somehow my $found = $right_text =~ m/$regex/$flags;
How do I $found == 3? How do I get from $left_text to $regex? What $flags?
++ to all replies but the prize goes to AR for an especially compact solution.
Sorry; it's not clear to me what I want for various variations on the supplied data. I want to be able to tell, in a general way, whether lengthy text output is more or less as I expect. I will probably adopt AR's approach and tinker with the $left_text, accepting a certain degree of uncertainty.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex Find Words
by moritz (Cardinal) on Apr 29, 2010 at 17:23 UTC | |
|
Re: Regex Find Words
by AnomalousMonk (Archbishop) on Apr 29, 2010 at 17:22 UTC | |
|
Re: Regex Find Words
by AR (Friar) on Apr 29, 2010 at 17:23 UTC | |
by ikegami (Patriarch) on Apr 29, 2010 at 18:44 UTC | |
|
Re: Regex Find Words
by kennethk (Abbot) on Apr 29, 2010 at 17:27 UTC | |
|
Re: Regex Find Words
by BrowserUk (Patriarch) on Apr 29, 2010 at 17:45 UTC |