in reply to regex problem? deleting table entry
It is as zer says. There are characters in your variable that are special to the regular expression engine (namely | and +). An alternative to manually back-whacking them would be to use quotemeta or the \Q "operator" within the regular expression. Here are two examples that work the same ...
Example 1:
Example 2:$RTBL_ENTRY_DEL = quotemeta $RTBL_ENTRY_DEL; # ... and then later ... s/$RTBL_ENTRY_DEL//g;
I prefer the latter for what I believe are obvious reasons :-)s/\Q$RTBL_ENTRY_DEL//g;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: regex problem? deleting table entry
by meinke3 (Acolyte) on Mar 30, 2006 at 17:03 UTC |