2011-07-17 1 views
0

は、私はこのようになります文字列を持って選ぶためにはJavaScript /正規表現を必要とプロセスのURL

「何とか何とか何とか云々云々http://www.example.com/check?x=rabP4F3Mk&dept=check何とか何とか何とか...」

をする同様の例の文字列について

を私はより正確にを尽くす "チェック= rabP4F3Mk & DEPT":

以上、私は正規表現/このような文字列を返す のJavaScriptコードが必要です
if (the string contains "example.com/check?x="){ 
    return the portion of the token that contains "example.com/check?x=" after the "=" 
} 

答えて

1
matches = str.match(/example.com\/check\?x\=([^\s]*)/); 
if(matches.length > 1) return matches[1]; 
1
"example.com/check?x=asdfasdf".match(/check\?x=(.*)/)[1]