Equivalent to parsing the PCRE regular expression URL for .NET.

There is a PCRE regular expression for extracting urls here: http://daringfireball.net/2009/11/liberal_regex_for_matching_urls

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

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

+3
source share
1 answer

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

EDIT - double clicking on the intruder gave me the following:

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

5bmUB.png

+3
source

Source: https://habr.com/ru/post/1726280/


All Articles