Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Regular Expression Help

Regular Expression Help

Scheduled Pinned Locked Moved Web Development
regexcomhelptutorialquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Brian Van Beek
    wrote on last edited by
    #1

    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! [^]

    M 1 Reply Last reply
    0
    • B Brian Van Beek

      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! [^]

      M Offline
      M Offline
      mtone
      wrote on last edited by
      #2

      The same way you are finding North find Avenue after it or you can look for North and a number. Show us your code.

      B 1 Reply Last reply
      0
      • M mtone

        The same way you are finding North find Avenue after it or you can look for North and a number. Show us your code.

        B Offline
        B Offline
        Brian Van Beek
        wrote on last edited by
        #3

        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! [^]

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups