\b is only going to find a work boundary for you if you agree with what \w thinks is a word character. If you want to have an expanded notion of what is a word, using \b is not going to do what you want.
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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.