kulls has asked for the wisdom of the Perl Monks concerning the following question:
Thank you in advance. - kullsuse strict; use warnings; my @str=qw(ab_xcc3 ab_xcc3_000 ok_and rajak_acc_idx rajak_acs_idx BMW_acc BMW_asc vc_ba vc_ba_002 dc_sts1 dc_sts6_005); for(@str) { my ($temp)=$_=~/^(\w{2})\_/xi; if($temp) { ($temp) =$_=~/^(\w{2}\_[a-z0-9]+)/xi; print $temp."\n"; } else { ($temp)=$_=~/^([a-z0-9]+)\_/xi; print $temp,"\n"; } } __OUTPUT___ ab_xcc3 ab_xcc3 ok_and rajak BMW vc_ba vc_ba dc_sts1 dc_sts6
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regular Expression - pattern matching
by McDarren (Abbot) on Feb 22, 2006 at 08:47 UTC | |
by kulls (Hermit) on Feb 22, 2006 at 09:22 UTC | |
by McDarren (Abbot) on Feb 22, 2006 at 10:21 UTC | |
by kulls (Hermit) on Feb 22, 2006 at 12:44 UTC | |
by McDarren (Abbot) on Feb 22, 2006 at 17:55 UTC | |
|
Re: Regular Expression - pattern matching
by borisz (Canon) on Feb 22, 2006 at 08:47 UTC | |
|
Re: Regular Expression - pattern matching
by pKai (Priest) on Feb 22, 2006 at 08:33 UTC |