Re: Regex advice

[email protected] (Steve Bertrand)
Newsgroups perl.beginners
Message-ID <[email protected]>
>> What I mean is, if you were to use a regex as opposed to using 
>> split(), how would you have written:
>>
>> if (/.*simscan~\[\d+\]~([\w|\s]+).*?~(\d+\.\d+)s~.*?~(.*?)~(.*?)~(.*)/) {
>>
>> ...to do the task I originally requested help with?
> 
> Aside from removing .* at the beginning and removing '|' from the 
> character class the other parts should work as desired.

Indeed, it certainly does. I now understand why the .* at the beginning 
is redundant and furthermore causes undue overhead.

I also have a better understanding of how a character class works.

That said, I think I'll stick to my tried and true method of using split :)

Thanks,

Steve
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.