I am looking to find a random alpha-numeric ID from a URL returned in some JSON. Using the example:
我希望从某个JSON返回的URL中找到一个随机的字母数字ID。使用的例子:
"responseURL" : "http://sutureself.com/userid/123abc"
... I want to just match on the 123abc
. So far I have:
…我想在123abc上比赛。到目前为止我有:
http://sutureself.com/userid/([a-z0-9]+)
... but this matches the whole URL. What do I need to add to only match this ID? Note, the length of the ID can differ.
…但这与整个URL匹配。为了匹配这个ID,我需要添加什么?注意,ID的长度可能不同。
2 个解决方案
#1
1
Looks like you need to set the template to "$1". See comments in this related post.
看起来您需要将模板设置为“$1”。请参阅相关文章中的评论。
#2
2
How about this:
这个怎么样:
[^/]+(?="})
Working regex example:
工作的正则表达式的例子:
http://regex101.com/r/pT3fG8
#1
1
Looks like you need to set the template to "$1". See comments in this related post.
看起来您需要将模板设置为“$1”。请参阅相关文章中的评论。
#2
2
How about this:
这个怎么样:
[^/]+(?="})
Working regex example:
工作的正则表达式的例子:
http://regex101.com/r/pT3fG8