You might as well use a character class since you aren't being too discriminatory about the words you match (i.e., your RE will also match a "word" like foo'bar'baz)
while ($string =~ /([\w'-]+)/g) { ... }
Note that you have to put the dash character either as the first or last character in the character class so that it isn't interpretted as a range
In reply to Re: Regexp explanation
by duff
in thread Regexp explanation
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |