in reply to RegEx pattern
Notice that the group (?:Enterprise situation\s+) is a non-capturing parentheses group, which means that $1,$2,$4 are unaffected by the new group. You might also do the same with (?:on|for) which would mean that $4 becomes $3. This avoids the overhead of capturing text you don't need and, more importantly, means you can concentrate on the groups you are actually interested in.if ($elementHash->{MSGTEXT} =~ /CDATA\[(\S+)\s+(?:Enterprise situation +\s+)?(\S+)\s+.+(on|for)\s+(\S+)\./)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: RegEx pattern
by MarcAllan (Novice) on Aug 30, 2011 at 17:27 UTC |