-1
嗨,我刚刚在Javascript中使用正则表达式,我试图获得一种模式,允许我从我的网站获取网址中的特定单词。正则表达式来匹配网址中的单个词
我有这方面的范例网址:
- http://www.mysite.com/site/firstsection/sections/index.html
- http://www.mysite.com/site/ sectionwithanyname /节/促销/ register.html
- http://www.mysite.com/site/anothersection/subscribe/myname/logo.html
我需要返回的单个字的模式HTTP ://www.mysite.com/site/和/index.html在第一个url中,这意味着“firstsection”返回,“sectionwithanyname”等。
<p>Any help is very apreciated!!!</p>
<p>Thanks a lot!!!</p>
我一直在玩Gskinner RegExr试图字匹配,但我一直没靠近:( – user3107122
这本来是更好的,如果你已经把你最接近的正则表达式放在你的问题中,或者可能是你已经尝试过的几个正则表达式 – Jerry
你确定要“firstsection”而不是“firstsection/sections”吗? – Matus