Jerry Preston wrote:

> Hi!
> 
> I do not understand why my regex works , then does not.
> 
> regex:
> 
> my  (@dat) = /(\w+\s+\w+\s+)=\s+(\w+)_(\w+)_(\w+)_/;

                                                    ^
This last underscore is expected.


> 
> Works!
> 
>     Process Name = D4_jerry_5LM_1.91_BF 
> 
> Returns:
> 
>    Process Name DM4 15C035 5LM
> 
> Does NOT work:
> 
>    Process Name = d4_jerry_5lm 


So only
Process Name = d4_jerry_5lm_
would work


> Is there a better way to write this regex?

Just remove the unneccessary underscore or add a ? after it.

BTW: I believe I would choose a completely different way:

my ($key,$name) = split /\s+=\s+/;
my @name_part   = split /_/, $name;

Greetings,


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

Reply via email to