Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: regex to match the following

by wfsp (Abbot)
on May 08, 2007 at 10:59 UTC ( #614116=note: print w/ replies, xml ) Need Help??


in reply to regex to match the following

Your data has tags and attributes so out of curiosity I parsed it with HTML::TokeParser::Simple.

#!C:/Perl/bin/perl.exe use strict; use warnings; use HTML::TokeParser::Simple; my $data = do {local $/;<DATA>}; my $p = HTML::TokeParser::Simple->new(\$data); my @table; while (my $t = $p->get_tag('meta-parameter')){ if ( $t->get_attr('type') and $t->get_attr('type') eq q{stored-procedure} and $t->get_attr('id')) { push @table, $t->get_attr('id'); } } print "->$_<-\n" for @table; __DATA__ <meta-parameter type="stored-procedure" id="rep_vfnz_gsm_bss_tch_netwo +rk_report_spr">\ <meta-parameter id="rep_vnz_gprs_quality_report_daily_spr" type="store +d-procedure">\ <meta-parameter type="stored-procedure" id="rep_vfnz_gsm_nss_benchmark +ing_report_spr">\ <meta-parameter id="rep_vnz_cchnwpossumreport2_spr" type="stored-proce +dure">\ <meta-parameter id="rep_vnz_cchnwpossumreport_spr1" type="stored-proce +dure">\ <meta-parameter id="rep_vnz_cchnwpossumreport2_spr" type="stored-proce +dure">\ <meta-parameter type="stored-procedure" id="rep_vfnz_gsm_bss_tch_netwo +rk_report_spr">\ <meta-parameter type="stored-procedure" id="rep_kit">\ <meta-parameter type="stored-procedure" id="rep_kit">\ <meta-parameter type="stored-procedure" id="rep_kit">\ <meta-parameter type="stored-procedure" id="rep_kit">\ <meta-parameter type="stored-procedure" id="rep_vnz_cchnwpossumreport_ +spr1">\ <meta-parameter type="stored-procedure" id="rep_data_availability_spr" +>\ <meta-parameter type="stored-procedure" id="rep_vnz_optregionnwperfrep +ort_spr">\ <meta-parameter type="stored-procedure" id="rep_vnz_optregionnwperfrep +ort_spr">\ <meta-parameter type="stored-procedure" id="rep_vnz_attach_success_rat +io_report_spr">\ <meta-parameter type="stored-procedure" id="rep_vnz_attach_success_rat +io_report_spr">\ <meta-parameter id="rep_vnz_cchnwpossumreport_spr1" type="stored-proce +dure">\ <meta-parameter id="rep_vnz_cchnwpossumreport_spr1" type="stored-proce +dure">\ <meta-parameter id="rep_vfnz_gsm_bss_tch_network_report_spr" type="sto +red-procedure">\
output:
->rep_vfnz_gsm_bss_tch_network_report_spr<- ->rep_vnz_gprs_quality_report_daily_spr<- ->rep_vfnz_gsm_nss_benchmarking_report_spr<- ->rep_vnz_cchnwpossumreport2_spr<- ->rep_vnz_cchnwpossumreport_spr1<- ->rep_vnz_cchnwpossumreport2_spr<- ->rep_vfnz_gsm_bss_tch_network_report_spr<- ->rep_kit<- ->rep_kit<- ->rep_kit<- ->rep_kit<- ->rep_vnz_cchnwpossumreport_spr1<- ->rep_data_availability_spr<- ->rep_vnz_optregionnwperfreport_spr<- ->rep_vnz_optregionnwperfreport_spr<- ->rep_vnz_attach_success_ratio_report_spr<- ->rep_vnz_attach_success_ratio_report_spr<- ->rep_vnz_cchnwpossumreport_spr1<- ->rep_vnz_cchnwpossumreport_spr1<- ->rep_vfnz_gsm_bss_tch_network_report_spr<-

Also out of curiosity, do monks really prefer having the and at the begining of the line?


Comment on Re: regex to match the following
Select or Download Code
OT: formatting conditional expressions
by kyle (Abbot) on May 08, 2007 at 14:30 UTC

    Also out of curiosity, do monks really prefer having the and at the begining of the line?

    I do. Those boolean operators are a lot like control flow statements (e.g., next) because they control whether different parts of the expression are evaluated. I like to have them out front, clearly visible. That way I can more easily tell what might run and what might not.

Re^2: regex to match the following
by jimt (Chaplain) on May 08, 2007 at 14:55 UTC

    Also out of curiosity, do monks really prefer having the and at the begining of the line?

    Most definitely. It's easier to comment out a conditional to flip it off for debugging purposes, or if you just decide you don't want it any more. One comment at the start of the line and I'm finished.

    The only remotely tricky thing that pops up is for the last conditional in a block, because that one'll have the semicolon at the end. Solution in that case? ;#. Not quite as clear for the poor sap who maintains it after it's commented that way, but still easy to type.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://614116]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2014-07-23 01:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (131 votes), past polls