Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Reg Expression translation

by danger (Priest)
on Nov 14, 2003 at 19:39 UTC ( #307178=note: print w/ replies, xml ) Need Help??


in reply to Reg Expression translation

Please help me understand the below reg expressions:
/^\s*$/
means check for all spaces in the entry. Check for beginning spaces and spaces in the middle and ending with a space??

It means: match the beginning of the string, followed by zero or more whitespace characters, followed by the end of the string. Essentially, it matches what we often think of as a "blank" line.

/^\w{1,}@/
Check for beginning with one word only and a '@' ??

Match beginning of string, followed by 1 or more word characters (those being of the class: [a-zA-Z0-9_]) followed by the '@' character.

To really understand regular expressions better, please see the following documents: perlrequick, perlretut, perlre. Also, Jeffrey Friedl's "Mastering Regular Expressions" is an excellent resource.


Comment on Re: Reg Expression translation
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://307178]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (8)
As of 2015-07-02 01:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (25 votes), past polls