in reply to Re: Re: Regexp explanation
in thread Regexp explanation

So then why did you put the quotes in your regex?

Never mind. It is important to remember that the Perl regexps are greedy: they will match as much as possible. Therefore to match a word, you only need to specify what a word is, there is no need to define what it's delimiters might be.

That simplifies the regexp to:

/([\w-]+)/g