开发者

Regular expression to search for a specific string along with unknowns

Im attepting to find the regex to pull the

 http://{any_string}.blogspot.com/feeds/{any_string}/comments/default

out of

 <link rel="alternate"
 type="application/atom+xml"
 title="{any_string}"
 href="http://{any_string}.blogspot.com/feeds/{any_string开发者_如何学Go}/comments/default"
 />

I know basics of regex and using eregi but im unsure of how to include constant characters such as the http://, etc in the regex expression!

Thanks!


http://.*\.blogspot\.com/feeds.*/comments/default

Where . matches newlines


Characters just match themselves (except some special ones like dot and backslash):

http://\S+\.blogspot\.com/feeds/\S+/comments/default

As pointed out, with php's preg_match, you may have to escape the solidii:

preg_match("/http:\/\/\S+\.blogspot\.com\/feeds\/\S+\/comments\/default/", string_to_match_against);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜