Hey,
I need help in the following. I need a reg ex to match the following set of lines:
liblaser2 8 80 346
lp "no print credits - denied"
"-18 + 500 = 482" (fdihdz 031877)
There are other lines too but are similar to these lines.
I have tried:
($printer, $rest) = $stats =~ /(\w{2,12})\s(\d{1,2}\s\d{1,4}\s\-?\d{1,4})/;
$printer saves thename of the printer (liblaser, lp etc) and $rest saves everything else. The reg ex that I have can't deal with quotes.
Can anyone come up with a reg ex that can save the printer name (if present)in $printer and save the rest of the string in $rest? and If string starts off with a quote. save it in either $printer or $rest.??
Thanks in advance.
I need help in the following. I need a reg ex to match the following set of lines:
liblaser2 8 80 346
lp "no print credits - denied"
"-18 + 500 = 482" (fdihdz 031877)
There are other lines too but are similar to these lines.
I have tried:
($printer, $rest) = $stats =~ /(\w{2,12})\s(\d{1,2}\s\d{1,4}\s\-?\d{1,4})/;
$printer saves thename of the printer (liblaser, lp etc) and $rest saves everything else. The reg ex that I have can't deal with quotes.
Can anyone come up with a reg ex that can save the printer name (if present)in $printer and save the rest of the string in $rest? and If string starts off with a quote. save it in either $printer or $rest.??
Thanks in advance.