开发者

Grabbing a URL out of an NSString using regex

I have a string that I have parsed from XML using Google's GDataXML parser, and now I need to get the string narrowed down a little bit more. THe contents of the string currently looks like this:

<Side><Image source='http://website.stuff.edu/img/user'/></Side>

I can't change the way the xml is coming, so this is the string I have to parse. I have tried this regex:

http:(.*?)'
开发者_JAVA技巧

But it grabs the ending quote of the url which I don't want, I just need to grab from http to the end of the url...

I know this is like stupidly easy, but I am not sure of the syntax. Thanks for your help


What about this:

http://([^']+)

EDIT #1:

Basically, [^']+ is "anything other than single quote 1 or more times"

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜