I'm trying to write a regular expression that matches all word inside a specific string, but skips words inside brackets. I currently have one regex that matches all words:
/[a-z0-9]+(-[a-z0-9]+)*/i
I also have a regex that matches all words inside brackets:
/\[(.*)\]/i
I basically want to match everything that the first regex matches, but without everything the second regex matches.
Sample input text: http://gist.github.com/222857 It should match every word separately, without the one in the brackets.
Any help is appreciated. Thanks!