I need a regex which will do the following
Extract all strings which starts with http://
Extract all strings which starts with www.
So i need to extract these 2.
For example there is this given string text below
house home go www.monstermmorpg.com nice hospital http://www.monstermmorpg.com this is incorrect url http://www.monstermmorpg.commerged continue
So from the given above string i will get
www.monstermmorpg.com
http://www.monstermmorpg.com
http://www.monstermmorpg.commerged
Looking for regex or another way. Thank you.
C# 4.0
You can write some pretty simple regular expressions to handle this, or go via more traditional string splitting + LINQ methodology.
Regex
Explanation Pattern:
Basically the pattern looks for strings that start with
http:// OR https:// OR www. (?:https?://|www\.)
and then matches all the characters up to the next whitespace.Traditional String Options