in reply to Re: Excluding groups of characters in regular expressions
in thread Excluding groups of characters in regular expressions
$_='$0<paragraph>$1<paragraph>$2</paragraph>$3<paragraph>$4<paragraph> +$5</paragraph>$6</paragraph>$7</paragraph>$8<paragraph>$9</paragraph> +$10<paragraph>$11</paragraph>$12 '; ($re=$_)=~s/((<paragraph>)|(<\/paragraph>)|[^<]+|.)/${[')','']}[!$3]\Q +$1\E${['(','']}[!$2]/gs; $re=join"|",map{quotemeta}(eval{/$re/}); s{($re)}{local $_=$1;s#</?paragraph>##g;$_}eg; print;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Excluding groups of characters in regular expressions
by suaveant (Parson) on Dec 21, 2007 at 19:52 UTC |