Drongo_III Posted May 21, 2017 Share Posted May 21, 2017 Hi Guys Stuck on what is probably a very easy thing. I'm adding wildcard route to an application and I'm using regex to match anything UNLESS it's preceded by /admin/ in which case I don't want the match to succeed. I want to match: /foo/bar/ I don't want to match: /admin/foo/bar I figured this was a job for Negative Lookbehind but it doesn't work when I follow the lookbehind with a character class like so: ^\/(?<!admin)[a-z0-9\-\/]* This doesn't work as /admin/test/ still matches the full string - even though I would expect anything following the word 'admin' to fail. So either you cannot use a character class after a lookbehind, or I'm doing it wrong. Any advice would be most welcome! Drongo Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.