in reply to combine two-part regex test

fancy experimental features? ;-)
#!/usr/bin/perl -l use strict; use warnings; my @str = split /\n/, <<'HTML'; <tr class="meld"><th>Security Code Matched</th><td>foo</td></tr> <tr><th>Security Code Matched</th><td>N/A</td></tr> <tr><th class="foo">Security Code Matched</th><td>N/A</td></tr> <tr><th>Security Code Matched</th><td>10!</td></tr> <tr><td>Security Code Matched</td><td class="val">N/A</td></tr> HTML for (@str) { if ( m{ \bSecurity\ Code\ Matched\b (.*?)</tr> (?(?{ index($^N, 'N/A') < 0 })!) }xsg ) { print "[[$_]]"; } }
output:
[[<tr><th>Security Code Matched</th><td>N/A</td></tr>]] [[<tr><th class="foo">Security Code Matched</th><td>N/A</td></tr>]] [[<tr><td>Security Code Matched</td><td class="val">N/A</td></tr>]]
i wouldn't use it at home, though ;-)
--
AltBlue.