hi,
i want to sort addresses and split them. a line looks like:
Acmelake Road 104 80741 Funkytown
Now I want to split before and after the Zip Code which is always 5 digits.
So the result should be:
Acmelake Road 104|80741|Funkytown
Thanks,
Marti
SORT ADDRESSES
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
I'm not completely sure what you want to use to replace the spaces but the following should be a starter.
With regular expressions enabled in the search and replace dialog, you need to search for the following string:
Hope this helps.
With regular expressions enabled in the search and replace dialog, you need to search for the following string:
Please note the spaces here either side of the (). Use the following replacement expression.([0-9]{5})
This will search for the 5 character number sourrounded by spaces, creating a back reference for the 5-digit character found. \1 in the replacement expression is used to replace the number found.|\1|
Hope this helps.
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
Martib: There is no need to double-post.
From what you say, it appears that you've selected Regular expression in the Replace dialogue box, and you're using Posix regular expression syntax:
His suggestion definitely works. Please try it again and check your typing carefully.
As for your other request, to match strings of digits with embedded spaces, such as 193 00 (which are not ZIP codes), this will do that:
([0-9]{3} [0-9]{2}) or ([0-9][0-9][0-9] [0-9][0-9]) (with a space at the beginning and at the end).
To catch ZIP codes with or without the improper space, use this:
([0-9]{3} ?[0-9]{2}) or ([0-9][0-9][0-9] ?[0-9][0-9]) (with a space at the beginning and at the end).
But you haven't provided enough information for us to be sure we're catching the ZIP codes and only the ZIP codes.
From what you say, it appears that you've selected Regular expression in the Replace dialogue box, and you're using Posix regular expression syntax:
Otherwise, the regular expression Steve offered you wouldn't have matched at all.Configure | Preferences | Editor
[X] Use POSIX regular expression syntax
His suggestion definitely works. Please try it again and check your typing carefully.
As for your other request, to match strings of digits with embedded spaces, such as 193 00 (which are not ZIP codes), this will do that:
([0-9]{3} [0-9]{2}) or ([0-9][0-9][0-9] [0-9][0-9]) (with a space at the beginning and at the end).
To catch ZIP codes with or without the improper space, use this:
([0-9]{3} ?[0-9]{2}) or ([0-9][0-9][0-9] ?[0-9][0-9]) (with a space at the beginning and at the end).
But you haven't provided enough information for us to be sure we're catching the ZIP codes and only the ZIP codes.
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm