Hi Monks,
I have a bit more of a complicated regex which I am stuck with. User types in the string to be matched, e.g. toilet(32), and this should then be whacked into a regex to match to a variable.
I know the brackets are causing a problem, so the input string should go from /toilet(32)/ to this /toilet\(32\)/so the regex can function properly. Can anyone help me witha substitution regex to scan this string and prepend all non-complying characaters with "\".
Also, some of the strings will actually be some code, with the regex inside.e.g.
$line = 'if($appliance =~ /toilet(32)/)';
Should be:
$line = 'if($appliance =~ /toilet\(32\)/)';
If that makes sense :-)
Cheers