2 points

lookaround - Regex lookahead, lookbehind and atomic groups - Stack Overflow


dashboard

Fri Oct 16 2020 18:35:36 GMT+0000 (UTC)

Posted by @saisandeepvaddi

bar(?=bar)     finds the 1st bar ("bar" which has "bar" after it)
bar(?!bar)     finds the 2nd bar ("bar" which does not have "bar" after it)
(?<=foo)bar    finds the 1st bar ("bar" which has "foo" before it)
(?<!foo)bar    finds the 2nd bar ("bar" which does not have "foo" before it)
content_copy Copy

https://stackoverflow.com/questions/2973436/regex-lookahead-lookbehind-and-atomic-groups