See quotemeta.
Your a[0] is a valid regular expression and means "match an a, and then match a zero. quotemeta is what you need to make a literally matching string of your variable.
In reply to Re: Replace strings with []
by Corion
in thread Replace strings with []
by jess195
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |