in reply to Regex not matching &
In this case, I don't see any need for it at all, though. Just removing the \b's should do what you want. Perhaps add [;&\w] at the end if you don't want it to end with a hyphen.
Your regex will set $1 to everything from the first hyphen on, or to the last character of the "word" if there were no hyphens. That seems kind of bizzare. Are you using $1? If so, exactly which part of the word to you want it to contain? If not, you can simplify it to m/[;&\w][-;&\w]+/g, or if you mean to only match hyphenated words, m/[;&\w]+-[-;&\w]+/g.
Your //s and //i flags have no effect with your regex.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Regex not matching &
by murugu (Curate) on Mar 19, 2004 at 02:57 UTC | |
by Anonymous Monk on Jul 14, 2005 at 15:50 UTC |