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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Find a word using regular expression in c#

Find a word using regular expression in c#

Scheduled Pinned Locked Moved C#
csharpregexquestion
4 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.
  • P Offline
    P Offline
    PeriyasamyRamachandran
    wrote on last edited by
    #1

    Hi, I need to find a word using regular expression in c#. Can anybody have an idea? Please.. Thanks, Regards, Periyasamy

    S A 2 Replies Last reply
    0
    • P PeriyasamyRamachandran

      Hi, I need to find a word using regular expression in c#. Can anybody have an idea? Please.. Thanks, Regards, Periyasamy

      S Offline
      S Offline
      sanforjackass
      wrote on last edited by
      #2

      string s="sanforjackass"; s.Contain();

      1 Reply Last reply
      0
      • P PeriyasamyRamachandran

        Hi, I need to find a word using regular expression in c#. Can anybody have an idea? Please.. Thanks, Regards, Periyasamy

        A Offline
        A Offline
        Arindam Tewary
        wrote on last edited by
        #3

        Use Regex and MatchCollection class from System.Text.RegularExpression... sample code here Pattern "\w" stand for word .... Read here http://www.regular-expressions.info/charclass.html

                Regex obj = new Regex("\\\\w+");
                MatchCollection c = obj.Matches("3 idiots is an wonderful movie");
                foreach (Match m in c)
                {
                    MessageBox.Show(m.Value);
                }
        

        Thanks, Arindam D Tewary

        P 1 Reply Last reply
        0
        • A Arindam Tewary

          Use Regex and MatchCollection class from System.Text.RegularExpression... sample code here Pattern "\w" stand for word .... Read here http://www.regular-expressions.info/charclass.html

                  Regex obj = new Regex("\\\\w+");
                  MatchCollection c = obj.Matches("3 idiots is an wonderful movie");
                  foreach (Match m in c)
                  {
                      MessageBox.Show(m.Value);
                  }
          

          Thanks, Arindam D Tewary

          P Offline
          P Offline
          PeriyasamyRamachandran
          wrote on last edited by
          #4

          Hi, Thanks to your reply.It helps me. Regards, Periyasamy.

          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