and the [\.] is redundant, it's the same like [.] and won't match everything
Yes, I am aware of that. However the OP's question was to explain why the regex he provided, in all its baroque splendour, did not match both the input lines. I think it would be distracting to go changing his regex and then explain how the modified form works rather than answer the question as posed. There are plenty of things I would change about the given regex to achieve the same end were I to write it of which this is merely one. Although the first thing would be to lose the /x which is causing far more confusion than it removes in this case IMHO.
or a literal pipe symbol |
That's a good observation and I'll amend my post to mention it. Thanks.
🦛
In reply to Re^3: Regex, match one or other character class
by hippo
in thread Regex, match one or other character class
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |