packetstormer has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks
Not sure how I have never come across this before but I can't figure out how to get the rest of a string after it has been matched!? E.g:This code places my matched string in $1. However, I need to keep going to perform a regex on the remainder of the string. I could split the original string on the $1 value but am I missing a simple trick!?my $file = "TEST SHOW S01E01"; if(($file =~ m/(.*?)(\d+)/i) { my $show = $1; print "Show name: $show\n"; } Show name: TEST SHOW S
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex Matching Query
by davido (Cardinal) on Mar 25, 2013 at 21:38 UTC | |
|
Re: Regex Matching Query
by ww (Archbishop) on Mar 25, 2013 at 21:31 UTC | |
|
Re: Regex Matching Query
by m0skit0 (Initiate) on Mar 25, 2013 at 21:15 UTC | |
|
Re: Regex Matching Query
by 2teez (Vicar) on Mar 26, 2013 at 07:36 UTC | |
|
Re: Regex Matching Query
by nvivek (Vicar) on Mar 26, 2013 at 05:20 UTC | |
|
Re: Regex Matching Query
by hdb (Monsignor) on Mar 26, 2013 at 07:45 UTC | |
by ww (Archbishop) on Mar 26, 2013 at 15:02 UTC |