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. Regex uppercase

Regex uppercase

Scheduled Pinned Locked Moved C#
questionregex
5 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.
  • F Offline
    F Offline
    Farhad Eft
    wrote on last edited by
    #1

    Hi, I created my regex like the following:

    Regex regexEET = new Regex(".*?EET.*?");

    But this one also detects "eet". I was wondering how can I modify it to only search for uppercase "EET". Thank you.

    L P 2 Replies Last reply
    0
    • F Farhad Eft

      Hi, I created my regex like the following:

      Regex regexEET = new Regex(".*?EET.*?");

      But this one also detects "eet". I was wondering how can I modify it to only search for uppercase "EET". Thank you.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      That should only match strings containing EET in upper case. Please show the actual content that you are matching against?

      1 Reply Last reply
      0
      • F Farhad Eft

        Hi, I created my regex like the following:

        Regex regexEET = new Regex(".*?EET.*?");

        But this one also detects "eet". I was wondering how can I modify it to only search for uppercase "EET". Thank you.

        P Offline
        P Offline
        Pete OHanlon
        wrote on last edited by
        #3

        When I run your regular expression, I only get matches for EET. You haven't specified any regex options have you?

        This space for rent

        F 1 Reply Last reply
        0
        • P Pete OHanlon

          When I run your regular expression, I only get matches for EET. You haven't specified any regex options have you?

          This space for rent

          F Offline
          F Offline
          Farhad Eft
          wrote on last edited by
          #4

          Oh my! You guys are right!

          Regex regexEEST = new Regex(".*?EEST.*?",
          RegexOptions.IgnoreCase |
          RegexOptions.CultureInvariant |
          RegexOptions.IgnorePatternWhitespace |
          RegexOptions.Compiled);

          I didn't notice

          RegexOptions.IgnoreCase

          Thank you, your comments were very helpful.

          P 1 Reply Last reply
          0
          • F Farhad Eft

            Oh my! You guys are right!

            Regex regexEEST = new Regex(".*?EEST.*?",
            RegexOptions.IgnoreCase |
            RegexOptions.CultureInvariant |
            RegexOptions.IgnorePatternWhitespace |
            RegexOptions.Compiled);

            I didn't notice

            RegexOptions.IgnoreCase

            Thank you, your comments were very helpful.

            P Offline
            P Offline
            Pete OHanlon
            wrote on last edited by
            #5

            It's an easy mistake to make. Glad you got it sorted.

            This space for rent

            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