Hello esteemed monks, I am having trouble with a regex match on a string that contains a regex. I've not figured out how to match on it. This string appears in an HTML page:
document.write(this.location.href.replace(/\?resultof.*$/i, ''));
I need to find and replace it with something else, but I can't seem to match all those regex characters as literals. I've tried replacing all the parens, question marks, etc.
$j =~ s/\\/\\\\/g;
$j =~ s/\?/\\\?/g;
$j =~ s/\$/\\\$/g;
$j =~ s/\*/\\\*/g;
$j =~ s/[.]/\\./g;
$j =~ s/[)]/\\\)/g;
$j =~ s/[(]/\\\(/g;
any thoughts from the experts? thanks