Re: Regex advice

[email protected] (Steve Bertrand)
Newsgroups perl.beginners
Message-ID <[email protected]>
> The \w character class matches any "word" character where "word" is 
> defined as any alphabetic character or any numerical digit or the '_' 
> character.  The '|' which is used for alternation outside of a character 
> class just matches a literal '|' character inside a character class. The 
> \s character class matches any whitespace character.

Ok, it makes sense now that I know that the '|' is literal in the 
context that I had it.

>> This is more about receiving feedback and not about an answer, so as I 
>> go find out why things work as they have been described, would you 
>> project the statement as if you had written it yourself, just for 
>> comparison sake?
> 
> I don't think I understand your last question.

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?

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.