Mongo Shell Support For Negative Lookbehind RegExp,
'cccddd'.replace(/(?<!c)d/g, 'A')
Replace all `d` not preceded by `c` with `A`
Browser console:
cccdAA
However if I run this into mongo shell
MongoDB shell version v4.2.2
MongoDB server version: 4.2.2
> 'cccddd'.replace(/(?<!c)d/g, 'A')
2020-08-15T19:07:15.871+0530 E QUERY [js] uncaught exception: SyntaxError:
invalid regexp group :
@(shell):1:17
I can’t find any definitive documentation on what Mongo shell supports insofar, but it appears it doesn’t support negative look-behind (at least).