in reply to Re: Return value from positive look behind
in thread Return value from positive look behind
@Choroba: Another unusual thing happens if I run the code 2x in a row. The first if{} works but the second does not. Does the regex somehow need to reset?<\p>
my $body_text="there are 5 minutes left in the program"; if ($body_text=~m/(\d{1,2})(?=\smins|\sminutes)/g) { print "1st try: " . $1 . "\n"; } if ($body_text=~m/(\d{1,2})(?=\smins|\sminutes)/g) { print "2nd try: " . $1 . "\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Return value from positive look behind
by choroba (Cardinal) on Nov 11, 2020 at 17:17 UTC | |
|
Re^3: Return value from positive look behind
by GrandFather (Saint) on Nov 11, 2020 at 20:28 UTC |