Rob*_*tan 5 javascript string parsing text-parsing string-parsing
如何在javascript上解析此字符串,
var string = "http://www.facebook.com/photo.php?fbid=322916384419110&set=a.265956512115091.68575.100001022542275&type=1";
我只是想在字符串上得到" 265956512115091 ".我以某种方式解析了这个字符串,但仍然不足以得到我想要的东西.
我的代码:
var newstring = string.match(/set=[^ ]+/)[0];
Run Code Online (Sandbox Code Playgroud)
收益:
a.265956512115091.68575.100001022542275&type=1
Run Code Online (Sandbox Code Playgroud)
try this :
var g=string.match(/set=[a-z]\.([^.]+)/);
g[1] will have the value
Run Code Online (Sandbox Code Playgroud)
http://jsbin.com/anuhog/edit#source
| 归档时间: |
|
| 查看次数: |
22649 次 |
| 最近记录: |