【发布时间】:2013-08-21 01:56:32
【问题描述】:
我尝试解析一个带有http URL的字符串,例如,字符串是这样的
str = "http://www.abc.com?id=123&key=456 and more text here"
我想知道http url链接在哪里结束,基本上我用
string.find(str, "......")
我可以在其中放置什么模式,以便考虑 URL 结束?
【问题讨论】:
-
您在给出的示例中寻求的答案是什么?
-
给出的精确语法是w3.org/Addressing/URL/5_URI_BNF.html。
-
我用
string.find(str, "[^$-_+!*',%a%d:/.]"),对吗?但是它仍然将“)”视为 URL 的一部分似乎很奇怪......例如,str="http://abc)de.com"“)”被认为是 URL 的一部分(我期待http://abc被解析出来)
标签: string parsing url lua lua-patterns