I have managed to patern match / substitute every thing in a doc I am working on but cannot understand how to pattern match-subsitute "(510)" for ""
I hate when that happens.
I have searched for hours for the answer.
Finally after posting I find it.
----------------------------------------------------------
These are the characters that are given special meaning within a regular expression, which you will need to backslash if you want to use literally:. * ? + [ ] ( ) { } ^ $ | \ Any other characters automatically assume their literal meanings.
You can also turn off the special meanings using the escape sequence \Q . After perl sees \Q , the 14 special characters above will automatically assume their ordinary, literal meanings. This remains the case until perl sees either \E or the end of the pattern.
For instance, if we wanted to adapt our matchtest program just to look for literal strings, instead of regular expressions, we could change it to look like this:
You can also turn off the special meaning just for the one character, like this.
/\(510\)/;
That pattern will match the string '(510)'.
Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.