ghosh123 has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I am parsing the following file :
Users of Enterprise_VO: (Total of 1 license issued; Total of 0 licenses in use)
Users of Fusion: (Total of 4 licenses issued; Total of 0 licenses in use)
Users of Galaxy-AdvCTS: (Total of 5 licenses issued; Total of 0 licenses in use)
Users of Galaxy-AdvTech: (Total of 5 licenses issued; Total of 0 licenses in use)
Users of Galaxy-Common: (Total of 30 licenses issued; Total of 1 license in use)
But the below code is not able to match when there is a '_' or '-' in the string just after "Users of". For example 'Fusion' is matching but not 'Galaxy-AdvTech' and 'Enterprise_VO' etc.
while(<FILE>) { if(/^Users of ([\w+\_\-]):\s+\(Total of ([0-9]+) licenses issu +ed;\s+Total of ([0-9]+) (licenses|license) in use/) { print "$1 |$2|$3 \n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regular expression not matching
by kcott (Archbishop) on Mar 13, 2013 at 07:42 UTC | |
|
Re: regular expression not matching
by igelkott (Priest) on Mar 13, 2013 at 07:46 UTC | |
|
Re: regular expression not matching
by AnomalousMonk (Archbishop) on Mar 13, 2013 at 15:58 UTC | |
|
Re: regular expression not matching
by Anonymous Monk on Mar 13, 2013 at 06:34 UTC | |
by ghosh123 (Monk) on Mar 13, 2013 at 06:38 UTC | |
by Anonymous Monk on Mar 13, 2013 at 06:41 UTC | |
by ghosh123 (Monk) on Mar 13, 2013 at 06:46 UTC | |
by Anonymous Monk on Mar 13, 2013 at 06:53 UTC | |
by ghosh123 (Monk) on Mar 13, 2013 at 06:59 UTC | |
by Anonymous Monk on Mar 13, 2013 at 07:07 UTC |