Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: Help required on understanding regular expressions

by bimleshsharma (Beadle)
on Feb 21, 2012 at 06:37 UTC ( #955234=note: print w/ replies, xml ) Need Help??


in reply to Re: Help required on understanding regular expressions
in thread Help required on understanding regular expressions

I dont understand the code.. /(?<fname>\w+\b)\s(?<mname>\w+)\s(?<lname>\w+\s).*\[(?<date>[^\]]+)/ what it is looking for from string?


Comment on Re^2: Help required on understanding regular expressions
Download Code
Replies are listed 'Best First'.
Re^3: Help required on understanding regular expressions
by NetWallah (Abbot) on Feb 21, 2012 at 16:35 UTC
    /(?<fname>\w+\b) # Looks for "\w" (Word characters followed by a word +boundary (look up \w and \b) # and creates $+{name} \s(?<mname>\w+)\s # Same thing - Whitespace on both sides (?<lname>\w+\s) # Same thing .*\[(?<date>[^\]]+)/ # looks for "[", followed by anything that is NOT + "]", and populates $+{date}
    All this is in the "perlre" document.

                “PHP is a minor evil perpetrated and created by incompetent amateurs, whereas Perl is a great and insidious evil perpetrated by skilled but perverted professionals.”
            ― Jon Ribbens

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (11)
As of 2015-07-08 00:49 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 (93 votes), past polls