Re:Calculate the difference and intersection of any two regexes
by wizofaus on Tuesday September 12, 2023 @12:16AM
(#37476890)
Isn't that just
Unless you mean it as a search expression, in which case it's more like
Which I have to admit was a lot harder to figure out than I thought it would be (and may not even be right!)
[ Parent
| on HN ]
Re:Calculate the difference and intersection of any two regexes
by zeroimpl on Tuesday September 12, 2023 @07:43AM
(#37479572)
Yeah the latter.
In an engine supporting ^ and $, searching for this
(a|b|^)(c|d|^)foo
is equivalent to searching for this ^((.*a|.*b)(c|d)|c|d)?foo.*$
And in this context you can drop the leading/trailing ^/$ since they are implicit.