C#: What is a good Regex to parse hyperlinks and their description?
Please consider case insensitivity, white-space and use of single quotes (instead of double quote
As long as there are no nested tags (and no line breaks), the following variant works well:
(.*?)
As soon as nested tags come into play, regular expressions are unfit for parsing. However, you can still use them by applying more advanced features of modern interpreters (depending on your regex machine). E.g. .NET regular expressions use a stack; I found this:
(?:.*?)[""'].*?>)(?(?>(?)| (?<-DEPTH>)|.)+)(?(DEPTH)(?!))(?:)
Source: http://weblogs.asp.net/scottcate/archive/2004/12/13/281955.aspx