Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: regex match word , don't match word preceeded by slashby kcott (Archbishop) |
on Nov 19, 2010 at 02:26 UTC ( [id://872407]=note: print w/replies, xml ) | Need Help?? |
I've expanded the solution so it's a bit easier to read:
Test output:
Update: While the solution above answers your question, consider the following. If the HTML actually looks more like this:
Your output will look like:
If you'd prefer it to look like:
Remove both \s? lines, leaving:
You had them in your original so I left them in thinking they perhaps served some other purpose in the real data you're working on (as the string you posted contained no whitespace at all). -- Ken
In Section
Seekers of Perl Wisdom
|
|