Reputation: 21
How i can replace image's source , html text saved in database ?
thanks
Upvotes: 1
Views: 388
Reputation: 101176
http://social.msdn.microsoft.com/Forums/en-US/regexp/thread/37f46a25-113c-420d-aab8-eea98d341189
string s = "<img src='1.jpg'><img src='2.jpg'><img src='3.jpg'><img src='4.jpg'>";
string pattern = @"<img\s+src\s*=\s*["']([^"']+)["']\s*/*>";
string output = string.Empty;
output = Regex.Replace(s, pattern, "[Image: $1]");
Regex to get src value from an img tag
Upvotes: 0