Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
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?

Replies are listed 'Best First'.
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.

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://614116]
help
Chatterbox?
[Your Mother]: The exhibit, the tick, or the scrotum?
[erix]: (the man is even a paleontologist )
[1nickt]: erix unfortunately that's there favourite spot. That's why they are usually spotted crawling *up* your leg.
[erix]: ha, the tick and, as it happens, also the curator (now a professor of Paleont.)
[1nickt]: s/there/their/, ugh sorry.
[Your Mother]: Heh. The only one I ever had on me, I caught on my shin, headed north.
erix looks nervously I got away cleanly from my run , it seems :)
1nickt doesn;t remember there being ticks in the old country ...
erix too fast for ticks!
[erix]: 'the old country' is where?

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (15)
As of 2017-05-24 13:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?