KW.pm | Regular Expressions | #19 |
$_ = "Some string where where where where a word appears too often"; s/\b(\w+) (?=\1)//g;
/\b\w+\b(?<!disaster)/ # matches any word that doesn't end in disaster
<< Previous | Index | Next >> | Copyright © 2002 Christopher Calzonetti |