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#
regexquestion
5 Posts 2 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
    salmonraju
    wrote on last edited by
    #1

    Hi, I am having below regular expression /[^/]+/(?<Name1>[^/]+)/[^/]+/(?<Name2>.+) which will accept strings of below format /VB/XYZ/8/5/10103303.abc I want to extend my regular expression which will accept extra feild like " ?key=name3 so my input string will /VB/XYZ/8/5/10103303.abc?key=<name3> Please suggest Thanks,

    OriginalGriffO 1 Reply Last reply
    0
    • S salmonraju

      Hi, I am having below regular expression /[^/]+/(?<Name1>[^/]+)/[^/]+/(?<Name2>.+) which will accept strings of below format /VB/XYZ/8/5/10103303.abc I want to extend my regular expression which will accept extra feild like " ?key=name3 so my input string will /VB/XYZ/8/5/10103303.abc?key=<name3> Please suggest Thanks,

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      Just tag it on the end: /[^/]+/(?<Name1>[^/]+)/[^/]+/(?<Name2>.+)\?(?<Key>.*)=(?<Token>.*) I strongly suggest you get a copy of Expresso [^]- it creates, explains, and tests regular expressions. [edit]replaced < and > with safe versions.[/edit]

      You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace

      modified on Wednesday, February 17, 2010 5:26 AM

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      S 1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        Just tag it on the end: /[^/]+/(?<Name1>[^/]+)/[^/]+/(?<Name2>.+)\?(?<Key>.*)=(?<Token>.*) I strongly suggest you get a copy of Expresso [^]- it creates, explains, and tests regular expressions. [edit]replaced < and > with safe versions.[/edit]

        You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace

        modified on Wednesday, February 17, 2010 5:26 AM

        S Offline
        S Offline
        salmonraju
        wrote on last edited by
        #3

        Hi, Thank you for your reply can you please make it more clear by providing full regular expression and this is a url string which is having querystring "key=" at the ending and I am reading this value using m.Groups["name3"] in my C# application. Thanks,

        OriginalGriffO 1 Reply Last reply
        0
        • S salmonraju

          Hi, Thank you for your reply can you please make it more clear by providing full regular expression and this is a url string which is having querystring "key=" at the ending and I am reading this value using m.Groups["name3"] in my C# application. Thanks,

          OriginalGriffO Offline
          OriginalGriffO Offline
          OriginalGriff
          wrote on last edited by
          #4

          Sorry about that - I have modified the original post. For some reason, the "encode "<" and other HTML characters" option is not working... /[^/]+/(?<Name1>[^/]+)/[^/]+/(?<Name2>.+)\?(?<Key>.*)=(?<Token>.*)

          You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace

          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
          "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

          S 1 Reply Last reply
          0
          • OriginalGriffO OriginalGriff

            Sorry about that - I have modified the original post. For some reason, the "encode "<" and other HTML characters" option is not working... /[^/]+/(?<Name1>[^/]+)/[^/]+/(?<Name2>.+)\?(?<Key>.*)=(?<Token>.*)

            You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace

            S Offline
            S Offline
            salmonraju
            wrote on last edited by
            #5

            Thank you it is working.

            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