----- Original Message -----
From: "pn" <[EMAIL PROTECTED]>
To: "prl_list" <[EMAIL PROTECTED]>
Sent: Friday, August 16, 2002 7:24 PM
Subject: Re: Help with regular expressions


>
>
> I ran into the following Regular expressions, but am
> unable to quite understand what each of these mean:
>
> Any help would be greatly appreciated, as I am fairly
> new to PERL.
>
> 1)
> 
>$abc=~/my_sdk\s+\-name\s+\{(\S+)\}\s+\-pid\s+(\S+)\s+\-wfm\s+\{\s*(\S+)\s+(\S+)\s*\}.*/gi)

$abc=~ / # So start the matching...
my_sdk   # require these words, (ie. 'my_sdk')
\s+      # some words(more than 1) are : \n , \t , \r, or \f
\-name   # require these words  (ie. '-name')
\s+      # some words(more than 1) are : \n , \t , \r, or \f
\{       # with a '{'
(\S+)    # some words(more than 1) are not \n \t \r or \f .
           # these words will be captured as $1 also.
\}       # with a '}'
\s+      # same as mensioned
\-pid    # with '-pid'
\s+      # same as mensioned
(\S+)    # same as mensioned but these words will be captured as $2.
\s+      # same as mensioned
\-wfm    # with '-wfm'
\s+      # same as mensioned
\{       # with '{'
\s*      # 1 word, or no word match to \n \r \t \f
(\S+)    # same as mensioned, but value will capture to $3
\s+      # same as mensioned
(\S+)    # same as mensioned... $4
\s*      # same as mensioned
\}       # with a '}'
..*       # anything or none
/        # end this matching
g        # matching is not doing once, but(I don't know how to explain)
         # Anyway, that mean after found the first match, the matching
         # will still continue.
i        # case non sensitive, (ie a eq A, B eq b and so on )
)        # This is syntax error =)



>
>
> 2)
>
$line=~/(\S+)\s+(\S+)\s+(\S+)\s+\S+\s+\S+\s+(\(\((.*)\)|no_value)\s+(\(\((.*)\)|no_value)\s+(\(\((.*)\)|no_value)\s+(\(\
((.*)\)|no_value)\s+\{\s*(\S+)\s*\}$/)

Mostly same as above, but | is means 'or', ie, match the before pattern|this are 
accept.
the () will carry matched pattern in order by $1, $2, $3....
the last $ means end of line.

Rgds,
Connie




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

Reply via email to