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;
In reply to Re: regex problem? deleting table entry
by duff
in thread regex problem? deleting table entry
by meinke3
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |