Oct 19, 2017, 11:23 PM
Post #2 of 4
What do you want to match exactly with the:
Re: [rpaskudniak] Escaping a special variable embedded in a regex
[In reply to]
There is most probably something wrong with it, but trying to fix it depends on the intended goal, which isn't clear to me.
If you want to match a literal [, then you need to escape it and it does not make sense to have a beginning of stgring anchor after it.
Square brackets introduce presumably a character class, but why would you want ^ or $ (beginning and end of string anchors) in a character class? It doesn't make much sense.
If you're looking for literal ^ and $ (sound unlikely, but who knows?), then I guess you would need to escape them (I can't test right now in public transportation toward my $work).
So, I would say, tell us what it is supposed to match, then we can think about how to fix it.