in reply to Parse mailing addresses with a regex
However if the data is very uniform, you can just wildcard the name and rely on everything else to lock down the position. Like this untested RE: /^(\d+)\s+(.*?)\s+(\d+.*?)\s+(\w\w)\s+(\d{3}-\d{3}-\S+)\s*(.*)/ The first capture will be the customer code, then the name, then street address, state, then telephone number (with allowance for extensions, as in 223-456-1234x56), then comment.
Looking at that again, a database would be far preferable. (If you don't do that, then add some validation checks. Because the data WILL entered badly, and that will be a constant battle to face.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Parse mailing addresses with a regex
by ferrency (Deacon) on Jun 23, 2003 at 14:39 UTC | |
by tilly (Archbishop) on Jun 23, 2003 at 14:49 UTC | |
|
Re: Re: Parse mailing addresses with a regex
by BrowserUk (Patriarch) on Jun 23, 2003 at 14:42 UTC |