ralphch has asked for the wisdom of the Perl Monks concerning the following question:
I have a variable that can contain strings such as "New_Features/Some_other_folder". I'm currently using the following match:
if($foo =~ 'Old_Archive') { print "do something"; }I was wondering if the =~ operator is the fastest and most efficient solution for this sort of matching, or if I should be using a Regex and, if so, which. I basically need to match any string that contains "Old_Archive" or "Old_Archive/something_else" or "Old_Archive/something_else/yet_another_path".
I would also appreciate if you can provide me with a good reference for regular expressions since I'm a little out of practice with them.
Thanks,
Ralph
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Best method for matching strings
by sgifford (Prior) on Nov 07, 2005 at 01:01 UTC | |
|
Re: Best method for matching strings
by EvanCarroll (Chaplain) on Nov 06, 2005 at 23:07 UTC | |
by sauoq (Abbot) on Nov 07, 2005 at 01:37 UTC | |
by friedo (Prior) on Nov 06, 2005 at 23:35 UTC | |
by EvanCarroll (Chaplain) on Nov 06, 2005 at 23:52 UTC | |
|
Re: Best method for matching strings
by friedo (Prior) on Nov 06, 2005 at 23:05 UTC |