The latter regex $test =~ s/"^mouse_(.+)"/$1/; is very close. The problem is that when you assign a string to a variable (eg: $test = "blah";), the quotes are stripped off. So it's the double-quote at the beginning of the regex that is breaking things. To further, ^ denotes the beginning of the string, so the " would never match even if there was one embedded in the string. Note though that the second double-quote at the end of the regex will allow the regex to match even though there isn't one in the string, because you capture everything (.+) up to it.
This works:
$test =~ s/^mouse_(.+)/$1/;
In reply to Re: s/// operator
by stevieb
in thread s/// operator
by perlUser345
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |