Extract word with regex except if it is a given word
I am trying to match and extract part of an URL with regex, except if it is a given word.
Here is some test data which already works:
/api/add --> no match /api/add/view --> no match /api/user1 --> matches and extracts "user1" /api/user1/profile/ --> matches and extracts "user1"
/api/aaa/profile/ --> matches and extracts "aaa"
Here is the current regex I have:
I works as I want except if it contains “a” or “d” instead of the entire “add” word.