我需要从URL中检索一些单词:
WebViewActivity - https://google.com/search/?term=iphone_5s&utm_source=google&utm_campaign=search_bar&utm_content=search_submit
return I want :
search/iphone_5s
但我卡住了,不太明白如何使用regexp_substr来获取那个数据。
我正在尝试使用这个查询:
regexp_substr(web_url, '\google.com/([^}]+)\/', 1,1,null,1)
仅返回“search”单词,并且当我尝试时
regexp_substr(web_url, '\google.com/([^}]+)\&', 1,1,null,1)
原来我获取的所有单词都是直到最后一个'&'为止。
https://example.com/?redirect_to=https://google.com/search/?term=iphone_5s
这样的URL?由于URL的编码方式,我不是100%确定。 - Benoît Zucom
替换为[^/]+
,请参见此演示。 - Wiktor Stribiżew