#!/usr/bin/perl use strict; use warnings; $_ = join '', <DATA>; s/(<p>(?:(?!<\/p>).)*<\/p>)(??{-1 == index $1, "\n\n" and '(*FAIL)'})/ +-->$1<--/gs; print; __DATA__ a 123 456 789 b 123 456 789 c 123 456 789 d 123 456 789 <p>e 123 456 789 f 123 456 789</p> <p>e 123 456 789 f 123 456 789 g 123 456 789 h 123 456 789</p> <p>1 123 456 789 2 123 456 789 3 123 456 789 4 123 456 789</p>
In reply to Re: regex exercise
by Anonymous Monk
in thread regex exercise
by Cilice
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |