That's because \t is a regex metacharacter. If you only want to escape some metacharacters, you'll need to figure out which ones.
If you want to escape all metacharacters beside backslash, something like:
should do it.s/([^A-Za-z_0-9\\])/\\$1/g;
In reply to Re: Re: Re: regex problem with metachars
by sgifford
in thread regex problem with metachars
by sweetblood
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |