> Hi, > I need some help on regular expression... > i have following in variable $total_count > > $total_count = "##I USBP 000001 10:38:09(000) > <xyz_abc_etrack_validation,6> ETRACK_TOTAL_RECS : 100" > > Here in this ETRACK_TOTAL_RECS is fixed and common for > all and rest is changing... > > like following > > $total_count = "##I USBP 000002 12:38:09(000) > <abc_gkkh_uiu,8> ETRACK_TOTAL_RECS : 500" > > > here i need some regular expression to get, 100 like > following > > $total_count = 100 >
tmtowtdi, but if I knew that I was going to have a number with no punctuation after the text "ETRACK_TOTAL_RECS : " that I wanted to capture, I'd do: $total_count =~ /ETRACK_TOTAL_RECS\s*:\s*(\d+)/; Then the number would be in $1. If I wasn't sure of the format (i.e., it could have a decimal, commas, etc), but knew that I wanted to capture everything from the : to the end of the string, I'd do: $total_count =~ /ETRACK_TOTAL_RECS\s*:\s*(.+)/; And the result would be in $1. Hope this helps, /\/\ark -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>