Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

regular expression matching a string that is followed with another string without capturing the latter

Is there an ability to make a lookahead assertion non-capturing? Things like bar(?:!foo) and bar(?!:foo) do not work (Python).

like image 908
madfriend Avatar asked Oct 09 '22 07:10

madfriend


1 Answers

If you do bar(?=ber) on "barber", "bar" is matched, but "ber" is not captured.

like image 88
zx81 Avatar answered Oct 12 '22 21:10

zx81