Node.js examples for Regular expression:Address
Get Street From Address using regex
'use strict';//from www. ja va 2 s .com Util.getStreetFromAddress = function(address) { // /[,?#\d]* / - Matches the first bits of the street number, enforcing // ending in space. // /[,\d]+[a-zA-Z]? / - All street addresses need at least one number, possibly // followed by a unit letter. // /[\d]*[a-zA-Z]+(?!\d)/ - Street names can start with numbers, 1st, // etc, but must not contain any letters followed by numbers, as // those are postal codes. // ((?:[\d]*[a-zA-Z]+(?!\d) ?)*) - Capture the full street name, // which can start with any numbers (132nd) but cannot contain numbers in // the middle or end, must have at least one letter (excludes US postal // code), and possibly repeats with 'St W'. return /[,?#\d ]*[,\d]+[a-zA-Z]? ((?:[\d]*[a-zA-Z]+(?!\d) ?)*)/.exec(address)[1].trim(); };