(?>expr)
) and what is it used for?
In https://www.regular-expressions.info/atomic.html, the only example is when expr
is alternation, such as the regex a(?>bc|b)c
matches abcc
but not abc
. Are there examples with expr
not being alternation?(?:expr)
) the same thing?Atomic groups (and the possessive modifier) are useful to avoid catastrophic backtracking - which can be exploited by malicious users to trigger denial of service attacks by gobbling up a server's memory.
Non-capturing groups are just that -- non-capturing. The regex engine can backtrack into a non-capturing group; not into an atomic group.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With