[Original] Regular Expression address match (Region City address)

Source: Internet
Author: User
In the project, you need to match the merchant's address. The key is to retrieve the user's path name. The user's address is an existing one. You only need to filter the outlet name from the existing address. Below is the Javascript Code Implementation: < Script >
VaR Reg =   / (. *? ) [No. Building Road in the city district] / IG;
VaR Address0 =   " No. 515, Yangpu district, guoding Road, Shanghai " ;
VaR Address1 =   " In the kongjia garden, building 4, No. 2421, xietu Road, Xuhui District " ;
VaR Address2 =   " 11-13, 6/F, zhengda Plaza, No. 168 Lujiazui West Road, Pudong New Area, Shanghai " ;
VaR Address3 =   " 11-13, 6/F, zhengda Plaza, No. 168 Lujiazui West Road " ;
VaR Address4 =   " 50/F haishen Hotel, 728 Pudong Avenue, Pudong New Area, Shanghai " ;
VaR Address5 = " Near Zhangjiang Metro, Pudong, Shanghai "
VaR Address = Address2;

// Press [Street roads in the City Lane]
VaR Result = Address. Match (REG );
If (Result)
{
// Search for matched results in the group
For ( VaR I = 0 ; I < Result. length; I ++ )
{
If (Result [I]. Match ( / (. +? ) [Path] / ))
{
Address = Result [I];
}
}
}
Alert (Address );
</ Script >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.