in reply to Re: Regex, match one or other character class
in thread Regex, match one or other character class
> either a dot or a space
or a literal pipe symbol | ²
The OP seems to think he can have two alternative character classes inside [...]
To achieve this he needs (?:[CLASS1]|[CLASS2]) ... (the ?: is for not catching).°
Probably he just confused it with (\.|\s) or (?:\.|\s)
Cheers Rolf
(addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
Wikisyntax for the Monastery
°) Sorry, in hindsight this doesn't make much sense (?:[CLASS1]|[CLASS2]) is the same like [CLASS1CLASS2] , 'or'-operations follow associative law
²) and the [\.] is redundant, it's the same like [.] and won't match everything
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Regex, match one or other character class
by hippo (Archbishop) on Apr 26, 2023 at 09:59 UTC | |
by LanX (Saint) on Apr 26, 2023 at 10:23 UTC |