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. c# Regex Help

c# Regex Help

Scheduled Pinned Locked Moved C#
questioncsharpgraphicsregexhelp
4 Posts 4 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.
  • W Offline
    W Offline
    will kirkby
    wrote on last edited by
    #1

    I have a string of the form "[1,'#000000','#ffffff']," I need to extract the '1' as an int, '#000000' as a System.Drawing.Color, and '#ffffff' as a System.Drawing.Color. I don't want to do repeated IndexOf(",") calls to get them, and regex appears to be the way to do this. I have looked on some tutorials and cannot work out how to do this. How do I extract these 3 variables from the string with Regex?

    N M P 3 Replies Last reply
    0
    • W will kirkby

      I have a string of the form "[1,'#000000','#ffffff']," I need to extract the '1' as an int, '#000000' as a System.Drawing.Color, and '#ffffff' as a System.Drawing.Color. I don't want to do repeated IndexOf(",") calls to get them, and regex appears to be the way to do this. I have looked on some tutorials and cannot work out how to do this. How do I extract these 3 variables from the string with Regex?

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      at the beginning and end


      only two letters away from being an asset

      1 Reply Last reply
      0
      • W will kirkby

        I have a string of the form "[1,'#000000','#ffffff']," I need to extract the '1' as an int, '#000000' as a System.Drawing.Color, and '#ffffff' as a System.Drawing.Color. I don't want to do repeated IndexOf(",") calls to get them, and regex appears to be the way to do this. I have looked on some tutorials and cannot work out how to do this. How do I extract these 3 variables from the string with Regex?

        M Offline
        M Offline
        Mikey_H
        wrote on last edited by
        #3

        Do a search for Expresso, this program was recomended to me, and helped me learn regular expressions.

        1 Reply Last reply
        0
        • W will kirkby

          I have a string of the form "[1,'#000000','#ffffff']," I need to extract the '1' as an int, '#000000' as a System.Drawing.Color, and '#ffffff' as a System.Drawing.Color. I don't want to do repeated IndexOf(",") calls to get them, and regex appears to be the way to do this. I have looked on some tutorials and cannot work out how to do this. How do I extract these 3 variables from the string with Regex?

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

          How about \[(\d+),'#([0-9A-Fa-f]{6,6})','#([0-9A-Fa-f]{6,6})'\] ? Tested with my RegexTester[^] :-D .

          modified on Monday, August 31, 2009 12:03 AM

          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