Im working on a node.js app, and im doing router matching.
I need to match all routes with all variables except the ones which begin with "public , static , files or same words with added "/"
i know i could do it using an if statement before regexp, to check if those words are withing url, and if they are, skip regexp, but i dont want to add such nesting, and knowing how to do it using regexp will become in handy in the future anyways.
i know how to match anything except...some letters, ie ^[0-9] , but i cant use the same for words. I googled and found that lookahead could solve this, but... i cant get it to work.
In the end, id like to use something like this (in pseudo code) where the .+ would match only if the pattern does not match any of the given words. match(/^(?!public|static|files) .+ /gi)
edit 1:
The format of the url's would be something like this..with or without slashes.
/controller/action/4/var:something/
i want to make a regexp that matches this controller - action - id pattern, but at the same time wouldnt match patterns like this /public/images/4 or static/files/somefile
in general, id like to know how to match a pattern, but only if it doesnt begin with given words.
e.g something like this...but it doesnt work ( match .+, but only if it doesnt contain the words mentioned before /^(?!public|static|files).+ /gi)