Regular expressions and matching URLs with metacharacters

Posted by James P. on Stack Overflow See other posts from Stack Overflow or by James P.
Published on 2010-03-26T00:51:06Z Indexed on 2010/03/26 3:53 UTC
Read the original article Hit count: 268

Filed under:
|

I'm having trouble finding a regular expression that matches the following String.

Korben;http://feeds.feedburner.com/KorbensBlog-UpgradeYourMind?format=xml;1

One problem is escaping the question mark. Java's pattern matcher doesn't seem to accept \? as a valid escape sequence but it also fails to work with the tester at myregexp.com.

Here's what I have so far:

([a-zA-Z0-9])+;http://([a-zA-Z0-9./-]+);[0-9]+

Any suggestions?

Edit: The original intent was to match all URLs that could be found after the first semi colon.

© Stack Overflow or respective owner

Related posts about regex

Related posts about java