$var = 'about/';
$var =~ s/^(.*)\/?$/index.php?action=$1/;
I want it to match and replace the trailing slash. But this is not so, I get this result:
index.php?action=about/
What am I doing wrong? I tried wrapping it in brackets (\/)?and including a question mark in a parenthesis (\/?). Apart from the previous slash, I'm obviously not doing any good. So how can I get him to have a slash when she is there?
source
share