Re: Multiple Captures under one group



amyl@xxxxxxxxxxxx wrote:
> I am having a hard time working out a regular expression that can
> capture multiple entries under a group.
>
> Here is the text I am working with
> 04/15/2005 00:01:37 G3C8F49 Results group [groups=7]: Sloan=SET
> Jones=OK JBUILD1=FAIL
>
> My goal is to have a "group" called groupnames that captures "Sloan,
> Jones, JBUILD1". I have worked the regular expression I have into
> being able to grab "Sloan", but I can't seem to figure out how to
> capture Jones and JBUILD1 as well.
>
> Here is the expression that I have up to that point.
[complex RE snipped]

You know, it always amazes me to what length people go to come up with the
most intriguing REs for a problem that could be solved much easier with two
or three lines of very straight-forward, simple code. Why not just

use warnings; use strict;
my$text = '04/15/2005 00:01:37 G3C8F49 Results group [groups=7]: Sloan=SET
Jones=OK JBUILD1=FAIL';
my @res=(split(/ /, $text))[-3..-1];
for (@res) {s/=.*$//;}
print "@res";

jue


.



Relevant Pages

  • Re: Multiple Captures under one group
    ... > capture multiple entries under a group. ... I have worked the regular expression I have into ... > capture Jones and JBUILD1 as well. ...
    (comp.lang.perl.misc)
  • Multiple Captures under one group
    ... I am having a hard time working out a regular expression that can ... capture multiple entries under a group. ... capture Jones and JBUILD1 as well. ...
    (comp.lang.perl.misc)