OK!

I see 2 as to 3.

Is there a way to make this regex smart enough to handle both string? Is
there a way that (\w+)_ can be changed to 2 to 10?

my  (@dat) = /(\w+\s+\w+\s+)=\s+(\w+)_(\w+)_(\w+)_/;

Thanks,

Jerry


-----Original Message-----
From: Nikola Janceski [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 09, 2002 9:41 AM
To: '[EMAIL PROTECTED]'; Beginners Perl
Subject: RE: regex is working , then not?


See inline comments

> -----Original Message-----
> From: Jerry Preston [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, October 09, 2002 10:36 AM
> To: Beginners Perl
> Subject: regex is working , then not?
>
>
> Hi!
>
> I do not understand why my regex works , then does not.
>
> regex:
>
> my  (@dat) = /(\w+\s+\w+\s+)=\s+(\w+)_(\w+)_(\w+)_/;
>
>
> Works!
>
>     Process Name = D4_jerry_5LM_1.91_BF
This one has 3 _ (underscores)

>
> Returns:
>
>    Process Name DM4 15C035 5LM
>
> Does NOT work:
>
>    Process Name = d4_jerry_5lm
This one has 2 _ (you are matching for 3 in your regex)

perhaps you should gather the last half and then split on _:
my  (@dat) = /(\w+\s+\w+\s+)=\s+([.\w]+)/;
push @dat = split /_/, pop @dat;
[untested]


>
> Is there a better way to write this regex?
>
> Thanks,
>
> Jerry
>

----------------------------------------------------------------------------
--------------------
The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to