[Pdx-pm] Regex

Brian Kurle brian.kurle at ieee.org
Sun Feb 5 09:40:54 PST 2012


You need to do the same thing with the first number to catch the commas if they exist there.


> if ($info =~ /Usage:([\d,]+)\s+of\s+([\d,]+)\s+messages/)


On Feb 4, 2012, at 10:59 PM, David E. Wheeler wrote:

> On Feb 4, 2012, at 10:54 PM, Russell Johnson wrote:
> 
>> Usage:524,944 of 1,000,000 messages
>> 
>> I need the two numbers. The old line was this:
>> 
>> Usage:524944/1000000 messages
>> 
>> Which I matched with the following code:
>> 
>> if ($info =~ m|Usage\:(\d+)/(\d+) messages|)
>> 
>> Further complicating matters is that the first number starts at 0, and counts up, so it won't always have a comma. I need to process the two numbers inside the if construct. 
> 
> if ($info =~ /Usage:([\d,]+)\s+of\s+(\d+)\s+messages/) 
> 
> HTH,
> 
> david
> _______________________________________________
> Pdx-pm-list mailing list
> Pdx-pm-list at pm.org
> http://mail.pm.org/mailman/listinfo/pdx-pm-list
> 



More information about the Pdx-pm-list mailing list