Regular Expression Help
-
Ok, I'm working on this project, we have a need to "standardize" our address data. So, right now, I have regular expressions that will turn North 7th Street into the USPS approved standard of "N 7th St" However, we have found out that we now have customers with addresses like "North Avenue" and it is unacceptable to report it as "N Ave" So, now to my actual question, is there a way with a regular expression ONLY to verify that the next word (after north for example) is not avenue. For clarifiaction, if the word Notrh is found, check to see if the very next word is avenue, and if it is, then we don't want to match. Any help would be appreciated. Thanks! Brian Van Beek Here's my boring blog! [^]
-
Ok, I'm working on this project, we have a need to "standardize" our address data. So, right now, I have regular expressions that will turn North 7th Street into the USPS approved standard of "N 7th St" However, we have found out that we now have customers with addresses like "North Avenue" and it is unacceptable to report it as "N Ave" So, now to my actual question, is there a way with a regular expression ONLY to verify that the next word (after north for example) is not avenue. For clarifiaction, if the word Notrh is found, check to see if the very next word is avenue, and if it is, then we don't want to match. Any help would be appreciated. Thanks! Brian Van Beek Here's my boring blog! [^]
-
The same way you are finding North find Avenue after it or you can look for North and a number. Show us your code.
Well, here's the problem, I can't just look for a number after it, because West Duff Avenue should become W Duff Ave. Here is what I have so far... ((\b[Nn][Oo][Rr][Tt][Hh])\b)|(\b[Nn]\b\.?) It's just a really simple regex to find the match, then I replace it with the appropriate abbreviation. This is all done during a sort of batched job. Now, I just need to be able to "not match" if the next word is avenue. But I want to do it all in one regex. Is this possible? [obviously you can tell that I'm a beginner in the world of regular expressions] Brian Van Beek Here's my boring blog! [^]