John Sheehan
John Sheehan

Reputation: 78132

Equivalent of URL parsing PCRE regex for .NET

There's a PCRE regex for extracting URLs posted here: http://daringfireball.net/2009/11/liberal_regex_for_matching_urls

\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))

What would need to be changed to make it compatible with regex in .NET?

Upvotes: 3

Views: 285

Answers (1)

Nicolas Webb
Nicolas Webb

Reputation: 1322

Looking at in Regexbuddy now. So far, the only issue is the [:punct:] - doesn't look like .NET supports POSIX character classes.

EDIT - double clicking on the offender gave me this:

\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^\p{P}\s]|/)))

Upvotes: 3

Related Questions