[英]Match on ID in URL with RegEx
I am looking to find a random alpha-numeric ID from a URL returned in some JSON. 我正在寻找一些JSON返回的URL中的随机字母数字ID。 Using the example:
使用示例:
"responseURL" : "http://sutureself.com/userid/123abc"
... I want to just match on the 123abc
. ...我只想匹配
123abc
。 So far I have: 到目前为止,我有:
http://sutureself.com/userid/([a-z0-9]+)
... but this matches the whole URL. ...但这与整个URL匹配。 What do I need to add to only match this ID?
我需要添加什么才能只匹配此ID? Note, the length of the ID can differ.
请注意,ID的长度可以不同。
How about this: 这个怎么样:
[^/]+(?="})
Working regex example: 工作正则表达式示例:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.