On 19 Apr 2004 18:58:30 -0700,
(LiHui)
wrote:
>Can someone tell me what does this line do ?
>
>$line =~ m/^\|\s*\w\S*\s*(?:\|.+?){10,}\|$/o
>
>I know that it check to see if the line begin with "|" follow by
>whitespace, word, nonwhitespace and than I'm lost. What is s*(?:\|.+?)
>
>Any help will be greatly appreciate. Thanks LH
I'll give it a go

My regex abilities are a bit rusty.
^\| line starts with |
\s* followed by 0 or more whitespaces
\w followed by an alphanumeric character
\S* followed by 0 or more non whitespaces
\s* followed by 0 or more whitespaces
(?:\|.+?){10,} is a quantified extended regex sequence (see below)
\|$ line ends with |
o switch tells the pattern to compile only once.
Quantified regex sequence :
(?:...) is a cluster only parenthesis, no capturing (thanks Camel
book) which I think means that the pattern matches, but does not store
the matched string in a variable. The remainder of this sequence is a
regular regex :
\| matches |
..+? matches one character, 1 or more times (minimally)
{10,} tells the pattern inside the () to match at least 10 times
Does that help or hinder?
Scott