in reply to regex exercise
#!/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>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: regex exercise
by Anonymous Monk on Aug 02, 2016 at 23:26 UTC |