Hi all,
I've got a set of regexps to escape asterisks and brackets:
I would use quotemeta, but I don't want to escape full stops (periods).
Can I combine the above statements into one regexp?
Is there a better way to escape a specific set of characters and not others?
Thanks, rotis23
I've got a set of regexps to escape asterisks and brackets:
Code:
$string =~ s/\*/\\\*/g;
$string =~ s/\(/\\\(/g;
$string =~ s/\)/\\\)/g;
I would use quotemeta, but I don't want to escape full stops (periods).
Can I combine the above statements into one regexp?
Is there a better way to escape a specific set of characters and not others?
Thanks, rotis23