Please tell me what might be wrong with my regex:
My string is: $string = "hello = 1234ab;cat;dog;4892";
I want to grab everything between the 2nd the and 3rd semicolons...
The $substring should print out dog, but instead it grabs all the string.my $semiColon=2; if ( $string =~ /hello.*=(\s*.*;\s*){$semiColon}(\s*.*;\s*).*/i ) my $substring = $2;
Thanks a lot in advance
In reply to regex picking out a particular string by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |