After looking through the answers that are already on StackOverflow regarding this issue, I settled with the most accurate one I could find:
Java regex: Negative lookahead
I went over to gskinner and tested it. I put /foo/(?!.*\\bbar\\b).+
in the pattern input box and the following in the regex match text area:
/foo/abc123doremi
/foo/abc123doremi/bar/def456fasola
Gskinner recognised both of these as matches though so clearly either Gskinner is wrong or the regex pattern above isn't correct. Any thoughts?