Are the following two regular expressions functionally equivalent? I ask because I get different results when I interchange them so I guess I know the answer is that they are not equivalent. However, I don’t understand why.
(,|$)
and
[,$]
I am basically looking for a comma or the end-of-line.
The first one means a comma or end_of_line
The second means a comma or a dollar sign
Generaly special characters inside a class lose their special meaning.
So, for your question:
Use the first one
(,|$)