Hi Everyone,
I'm new to this whole regex thing, and throughly confused. I need a regex that can pick out proper names from a document, which translates into a regex looking for 2 or more consequitive words that begin with a capital letter. Ideally this would include titles (Dr., Mr. etc) too. The names will reliably be in the proper format, the purpose of the script is just to count the occurances of different names.
What i have so far is:
[A-Z]+(([\'\,\.\- ][A-Z ])?[a-zA-Z]*)*
This works but it also picks up on single capitalized words, so any word at the beginning of a sentence will give a match. For example, the string "Hi, my name is John Smith" will return a match for "Hi" and "John Smith"
I feel like i'm really close with this, so needless to say its drive me nuts
please save me from this regex!!!
-swish