in reply to regex catch pattern that doesn't contain a pattern
To shed some light, tip #4 from the Basic debugging checklist (Data::Dumper):
use warnings; use strict; use Data::Dumper; "<div></div>" =~ /(?<start>.*?)((?!\< *\/[\w\d\-]+\>).)*/; print Dumper(\%+); __END__ $VAR1 = { 'start' => '' };
Tip #9: YAPE::Regex::Explain
---------------------------------------------------------------------- .*? any character except \n (0 or more times (matching the least amount possible)) ----------------------------------------------------------------------
Your regex is telling it that nothing is a valid match. Have you considered using an HTML parser module from CPAN?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: regex catch pattern that doesn't contain a pattern
by AnomalousMonk (Archbishop) on Apr 29, 2015 at 18:03 UTC | |
by toolic (Bishop) on Apr 29, 2015 at 18:08 UTC | |
by AnomalousMonk (Archbishop) on Apr 29, 2015 at 18:19 UTC | |
|
Re^2: regex catch pattern that doesn't contain a pattern
by Anonymous Monk on Apr 29, 2015 at 22:42 UTC |