[sf-perl] regular expression ?

Francisco Obispo fobispo at isc.org
Mon Sep 26 12:41:37 PDT 2011


And if the process is running continuously and matching several of these, you might want to:

my $patterm= qr/Thank you for your order:\s*(\d+)/;

if ($text =~ m/$patterm/){
	my $order_num=$1;
	# do stuff with $order_num

}


Francisco

On Sep 26, 2011, at 12:14 PM, Richard Reina wrote:

> I am trying to match a string "Thank you for order: 55555";
> 
> The order number will always change but I want the match to be true if the string has "Thank you for order:" followed by a number and extract the number.
> 
> Any help would be greatly appreciated.  
> _______________________________________________
> SanFrancisco-pm mailing list
> SanFrancisco-pm at pm.org
> http://mail.pm.org/mailman/listinfo/sanfrancisco-pm

Francisco Obispo 
email: fobispo at isc.org
Phone: +1 650 423 1374 || INOC-DBA *3557* NOC
Key fingerprint = 532F 84EB 06B4 3806 D5FA  09C6 463E 614E B38D B1BE







More information about the SanFrancisco-pm mailing list