You need something like this:
$Internal_variables{html} =~ s/whatever.cgi?blah=([^&]+)&more=([^&]+)&more2=([^&]+)/whatever-$1-more-$2-more2-$3.html/g;
[^&]+tells perl to match one or more any characters except '&' (or end of string). Thus it will stop matching when it hits '&'.
Putting part of regex into () will store it in $1, $2, $3 .. $n consequently.
If you want to group a part of regex, but not to 'remember' it do like this:
(:?regex)
I got
$Internal_variables{html} =~ s*$domainpath?Operation=ItemSearch\&SearchIndex=([^&]+)\&BrowseNode=([^&]+)*section/$1/isle/$2*g;
(I'm using * instead of / so I don't have to add a bunch of \'s.)
Which generates
/section/NAME-OF-CATEGORY&BrowseNode=229647
in the URL.
If I use just
$Internal_variables{html} =~ s*\&BrowseNode=*/isle/*g;
then the URL is correct
/section/NAME-OF-CATEGORY/isle/229647
Original URL
cgi-local/script.cgi?Operation=ItemSearch&SearchIndex=NAME-OF-CATEGORY&BrowseNode=229647
Edit: *Reads your post again.*
[^&]+ tells perl to match one or more any characters except '&' (or end of string). Thus it will stop matching when it hits '&'.
What would I change it to to make it also change the & mark?
If & is appearing in urls, something is going wrong somewhere. Where this encoding is used in html for urls, the browser should translate it to simply &. If the url is being created with javascript, encoding should use the escape() function to construct the query part.
Kaled.