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 help

RegEx help

Scheduled Pinned Locked Moved C#
questionregexjsonhelp
7 Posts 5 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.
  • S Offline
    S Offline
    Sunil P V
    wrote on last edited by
    #1

    Hi Gurus, I am using RegEx class for parsing some strings of the following format

    [Hello World message 234...]

    What is the expression that I need to use to format the above string?? Thanks...

    Sunil

    D L P 3 Replies Last reply
    0
    • S Sunil P V

      Hi Gurus, I am using RegEx class for parsing some strings of the following format

      [Hello World message 234...]

      What is the expression that I need to use to format the above string?? Thanks...

      Sunil

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      What do you mean by "formatting the above string"?? Are you looking to pull information out of the string?? What would that data be??

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak

      S 1 Reply Last reply
      0
      • D Dave Kreskowiak

        What do you mean by "formatting the above string"?? Are you looking to pull information out of the string?? What would that data be??

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak

        S Offline
        S Offline
        Sunil P V
        wrote on last edited by
        #3

        Hi Dave, This is my requirement. I read a line from a file, which is in the following format: [Some message 123...] So I would want to create a RegEx pattern for the above format. What would be the expression for this case. I tried this but it failed while calling method RegEx.Match():

        RegEx _exp = new Regex(@"^\[(?\w+)]", RegexOptions.IgnoreCase);

        Sunil

        D D 2 Replies Last reply
        0
        • S Sunil P V

          Hi Gurus, I am using RegEx class for parsing some strings of the following format

          [Hello World message 234...]

          What is the expression that I need to use to format the above string?? Thanks...

          Sunil

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

          Why are you using a RegEx when you can easily separate the tokens of the message with the String.Split()[^] method? Perhaps if you explain exactly what you are trying to do we can make some more informed suggestions.

          Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

          1 Reply Last reply
          0
          • S Sunil P V

            Hi Dave, This is my requirement. I read a line from a file, which is in the following format: [Some message 123...] So I would want to create a RegEx pattern for the above format. What would be the expression for this case. I tried this but it failed while calling method RegEx.Match():

            RegEx _exp = new Regex(@"^\[(?\w+)]", RegexOptions.IgnoreCase);

            Sunil

            D Offline
            D Offline
            djdanlib 0
            wrote on last edited by
            #5

            That still doesn't help. Why do you need a regex, what problem is it supposed to solve?

            1 Reply Last reply
            0
            • S Sunil P V

              Hi Gurus, I am using RegEx class for parsing some strings of the following format

              [Hello World message 234...]

              What is the expression that I need to use to format the above string?? Thanks...

              Sunil

              P Offline
              P Offline
              PIEBALDconsult
              wrote on last edited by
              #6

              There is a Regular Expression forum. Perhaps you should provide more examples and the results you want. If you want to separate the message part from the number part, perhaps something like this might help: @"(?'message'[^\d]*)(?'number'[\d]*)" or @"(?'message'.*?) message (?'number'.*)"

              1 Reply Last reply
              0
              • S Sunil P V

                Hi Dave, This is my requirement. I read a line from a file, which is in the following format: [Some message 123...] So I would want to create a RegEx pattern for the above format. What would be the expression for this case. I tried this but it failed while calling method RegEx.Match():

                RegEx _exp = new Regex(@"^\[(?\w+)]", RegexOptions.IgnoreCase);

                Sunil

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #7

                sunilkpv wrote:

                So I would want to create a RegEx pattern for the above format

                TO DO WHAT??

                A guide to posting questions on CodeProject[^]
                Dave Kreskowiak

                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