Perl Monk, Perl Meditation | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Did it though? Consider:
which prints:
Which string is correct? The (?<! ) is a zero width look back negative assertion: it matches if there isn't a space before the current space being matched. The (?! ) is a zero width look ahead negative assertion: it matches if there isn't a space after the current space being matched. Together these ensure that only single spaces are matched: only match a space that doesn't have a space before it and doesn't have a space after it. You should have a look at perlretut. Perl is Huffman encoded by design. In reply to Re^3: Regular Expressions: Removing 'only' single spaces from a string
by GrandFather
|
|