in reply to Re^2: Regex, match one or other character class
in thread Regex, match one or other character class

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.


🦛

Replies are listed 'Best First'.
Re^4: Regex, match one or other character class
by LanX (Saint) on Apr 26, 2023 at 10:23 UTC
    > Yes, I am aware of that.

    I know, this was directed at other readers and I wanted to cover all aspects, which ...

    > > The OP seems to think ...

    Cheers Rolf
    (addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
    Wikisyntax for the Monastery