云适配正则笔记

正则表达式的写法:

http://www.xxx.com 

http://www.xxx.com/index.html 

该组正则的写法如下: ^/$ 或者 ^/($|index.html$) 

 

http://www.xxx.com/travel/

http://www.xxx.com/hotel/

http://www.xxx.com/visa/ 

http://www.xxx.com/east/ 

该组正则的写法如下: 

^/travel/|^/hotel/|^/visa/|^/east/ 

^/(travel|hotel|visa|east)/ 

^/(travel/)|(hotel/)|(visa/)|(east/)

 

http://www.xxx.com/travel/africa/120.html

http://www.xxx.com/travel/africa/121.html

http://www.xxx.com/travel/africa/122.html

http://www.xxx.com/travel/africa/123.html 

该组正则的写法如下: 

^/travel/africa/[0-9]+.html 

^/travel/africa/[0-9]

 

http://www.xxx.com/travel/shou.html?id=1032

http://www.xxx.com/travel/shou.html?id=102878

http://www.xxx.com/travel/shou.html?id=1025

http://www.xxx.com/travel/shou.html?id=105



该组正则的写法如下: ^/travel/shou.html\?id=[0-9]+

 

你可能感兴趣的:(正则)