Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Regular expressions in VFP
Message
From
09/10/2008 20:27:18
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
09/10/2008 12:38:13
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9
OS:
Vista
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01353849
Message ID:
01353961
Views:
19
>>>I need to get names and addresses out of hundreds of letters into a table
>>>
>>>I have a routine which steps through the directory oipens each letter gets the content
>>>and now what?
>>>
>>>name and address i not always in the same spot
>>>
>>>can I get
>>>a the date with a regular wexpression
>>>and the name and address with a regular expression?
>>>
>>>thnks
>>>
>>>
>>>Peter
>>
>>How you recognize which is address and which is name?
>Also it would be nice to get the date

(\d{1,2})/(\d{1,2})[ ]*/[ ]*(\d{1,4}) is a regular expression I used once to get datelike strings, then tried to see whether they really represent dates - no 30th Februaries etc. Then replaced these with something neutral in the string holding a copy of the original text. You'll notice I added optional spaces in the middle of the expression - that's because I was finding those things in the text.

BTW, if you know the potential set of people in these addresses, you can get their names into a table, so if a couple of words you find in the text matches a name (in either first+last or last+first format) in your table, there's a good chance it is the name. Of course, the earlier in the text you find it, the better the chance. If you match two consecutive words to someone's name somewhere in the middle of a letter, that's probably not who wrote it or to whom it was addressed, but rather who they were complaining about :).

Parsing irregular text is a mess - but with all other troubles it has, English is better off here, because the word forms are so few - no declensions, conjugations and generally not much in the way of transformation which would change the spelling of the word while keeping it semantically the same word.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform