Regular Expression
-
I want to filter out some email address from a block of text. currently i use something like this which i found over internet. [\\w]+@[\\w]+.[\\w]{2,3} but it doesn't pick all email address, like some.one@some.ac.in can u help me, thanks, Derick Visit my tech blog http://techcapsules.blogspot.com
-
I want to filter out some email address from a block of text. currently i use something like this which i found over internet. [\\w]+@[\\w]+.[\\w]{2,3} but it doesn't pick all email address, like some.one@some.ac.in can u help me, thanks, Derick Visit my tech blog http://techcapsules.blogspot.com
You have to include some more characters in order to catch all valid email addresses:
[\w\-%~\.]+@[\w\-\.]+\.[\w]{2,4}
This will only match strictly standard conformant email adresses, though. You might want to include even more characters, as some people have email adressed that does not conform to the standard. --- b { font-weight: normal; } -
I want to filter out some email address from a block of text. currently i use something like this which i found over internet. [\\w]+@[\\w]+.[\\w]{2,3} but it doesn't pick all email address, like some.one@some.ac.in can u help me, thanks, Derick Visit my tech blog http://techcapsules.blogspot.com
Try this string s = @"^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6}$"; Regex ex = new Regex(s); Match match = ex.Match("g_s+gavcom.com"); if ( match.Success ) { MessageBox.Show("Found"); } Live Life King Size Alomgir Miah