[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cgi-list
Subject:    Re: [CGI] Newbie help with control chars
From:       "Mike Carpenter" <mikec () internet-software ! com>
Date:       1998-11-29 6:12:09
[Download RAW message or body]


-----Original Message-----
From: Gravel, Emmanuel (AZ77) <Emmanuel.Gravel@cas.honeywell.com>
To: 'cgi-list@jann.com' <cgi-list@jann.com>
Date: Saturday, November 28, 1998 11:51 PM
Subject: [CGI] Newbie help with control chars


>I've downloaded a perl script to study, but it came with no
>docs.  Here's a line that puzzles me a bit.  I'm wondering
>if anyone can help me with it:
>
>$msg =~ /^\S+\@\S+$/;
>
>Here's what I understand of it (which isn't much).  I know
>that =~ means that any alterations made by RHS will be
>saved in LHS.

close.  It means that LHS will be scanned for the RE (regular expression) on
RHS

>  I read that /.../ means "contains".  Here
>are the control chars I was able to find: ^ begining of line
>\S non-whitespace chars + match all $ EOL.


it is equivalent to m/.../  - the pattern matching operator.

>What I don't understand is \@ and why \S+ is repeated
>twice (i.e. I don't know what RHS is actually doing).


The expression is as follows:

^\S+ the string starts with one or more non-whitespace characters
   followed by
\@   an @ character
   followed by
\S+$ one or more non-whitespace characters ending the string.

This is an e-mail address (I assume) and it does not allow for any
whitespace at the beggining or end of the string.

Later...
Mike

-----------------------------------------------------------------
To unsubscribe, send mail to "majordomo@jann.com" with "unsubscribe cgi-list"
in the body.

The CGI Tips & Tricks website (and archive of the list) is located
at http://www.jann.com/Perl/

cgi-list is hosted by Summit Communication Design (http://www.summitdesign.net).

Summit Communication Design is a full-service web hosting firm
providing web design, cgi programming and inter/intra-net support.
-----------------------------------------------------------------

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic