in reply to Word boundary '\B' - Question

You might find the following to your liking:

$str =~ s|(?<=\S)\&\#x0007E\;\&\#x0007E\;\&\#x0007E\;(?=\S)|~~~|g;

Replies are listed 'Best First'.
Re^2: Word boundary '\B' - Question
by ysth (Canon) on Aug 21, 2006 at 21:32 UTC
    Since he particularly mentions alphanumeric or underscore, I think \w would be more appropriate than \S. Which would be equivalent to: $str =~ s/\b&#x0007E;&#x0007E;&#x0007E;\b/~~~/g;