Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Regular Expression

Regular Expression

Scheduled Pinned Locked Moved C#
comregexhelp
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Derick Cyril Thomas
    wrote on last edited by
    #1

    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

    G A 2 Replies Last reply
    0
    • D Derick Cyril Thomas

      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

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      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; }

      1 Reply Last reply
      0
      • D Derick Cyril Thomas

        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

        A Offline
        A Offline
        Alomgir Miah
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups