Re: Multiple Captures under one group
- From: "Jürgen Exner" <jurgenex@xxxxxxxxxxx>
- Date: Wed, 29 Jun 2005 14:59:23 GMT
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
.
- References:
- Multiple Captures under one group
- From: amyl
- Multiple Captures under one group
- Prev by Date: Single questions about file processing in perl
- Next by Date: Re: Multiple Captures under one group
- Previous by thread: Multiple Captures under one group
- Next by thread: Re: Multiple Captures under one group
- Index(es):
Relevant Pages
|
|