Regex to match partial words (JavaScript)

Posted by nw on Stack Overflow See other posts from Stack Overflow or by nw
Published on 2010-04-16T17:55:37Z Indexed on 2010/04/16 18:03 UTC
Read the original article Hit count: 568

Filed under:
|
|

I would like to craft a case-insensitive regex (for JavaScript) that matches street names, even if each word has been abbreviated. For example:

n univ av should match N University Ave

king blv should match Martin Luther King Jr. Blvd

ne 9th should match both NE 9th St and 9th St NE

Bonus points (JK) for a "replace" regex that wraps the matched text with <b> tags.

© Stack Overflow or respective owner

Related posts about regex

Related posts about JavaScript