I’m trying to send a regex to a mongo db that will match a comma separated value.
For example ‘aaa’ should match:
aaa, ancient, pattern, discipleship, faithful, followers matches
lowers,aaa, gospel, righteousness, strengthen, family matches
lowers, aaa , gospel, righteousness, strengthen, family matches
lowers, goaaaspel, righteousness, strengthen, family no match
lowers, aaaspel, righteousness, strengthen, family no match
lowers, gospel aaa truth, righteousness, strengthen no match
lowers, gospel aaa, righteousness, strengthen, family no match
lowers, gospel, righteousness, strengthen, family aaa no match
lowers, gospel, righteousness, strengthen, family, aaa matches
Thanks.
This seems to work on the attached example:
It basically means ‘aaa’ which has line start or comma before it and line end or comma after.
It will capture leading whitespace though, but you can fix that with grouping.