Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Extract names

by Anonymous Monk
on Feb 18, 2013 at 14:32 UTC ( #1019346=perlquestion: print w/ replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I would like to know how to extract names from a regex using notepad++?

Comment on Extract names
Re: Extract names
by ww (Bishop) on Feb 18, 2013 at 15:20 UTC
    We probably need more info to help.
    1. How do you define "names"?
    2. When you say "from a regex" do you mean the names are in a regular expression like  /sue mike fred rover/ or did you intend to ask how to extract names using a regex?
    3. What does your editor have to do with the question?

    Despite the danger in making assumptions, on a guess that you mean how does one extract names from a text document which contains names and other words, you may find some benefit from the following:

    a. Create an array with the names you want to extract (perl can do most anything, but washing windows and differentiating between names and other words are out of scope. See Tutorials)

    b. Slurp or read line-by-line (depending on the size of the document) the text file. open and, again, the tuts here.

    c. Test (see perlre, perlretut, et al_, word-by-word (for values of word meaning preceded or followed by a space, punctuation or EOL) in the line or file for matching against any of your array elements (names).
      If reading line-by-line, rinse and repeat.

    d. Capture the words that match names (see Tuts, the regex docs, etc) -- probably to an array with something like push @names_found, $name.

    e. Do something with the array.

    And, in deference to the values of the Monastery and those from whom you ask help, you might wish to read some of the documents that lay out what are considered "good practices" here at PerlMonks I know what I mean. Why don't you?, On asking for help and How do I post a question effectively?.


    If you didn't program your executable by toggling in binary, it wasn't really programming!

Re: Extract names
by karlgoethebier (Curate) on Feb 18, 2013 at 22:15 UTC
Re: Extract names
by Anonymous Monk on Feb 18, 2013 at 23:48 UTC
    Personally I would whack the regex upside the head with notepad++. That usually extracts a few names that, like this post, I should not write here.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (14)
As of 2014-09-22 20:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (198 votes), past polls