[Pdx-pm] Regex

Russell Johnson russ at dimstar.net
Sat Feb 4 22:54:25 PST 2012

Regex is not my strong suit. I'm modifying a regex. The part of the line being matched looks like this:

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. 

Russell Johnson
russ at dimstar.net

More information about the Pdx-pm-list mailing list