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. Reading Substring

Reading Substring

Scheduled Pinned Locked Moved C#
data-structurestestingbeta-testingtutorialquestion
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.
  • O Offline
    O Offline
    omlac
    wrote on last edited by
    #1

    Good day How do i find every occurence of a substring that begin with a specefied set of characters and end with another set of characters eg string str = "src=test.pgn testing sub src=file.pgn find it" i want to read strings that start with src and end with .pgn in the above example i want the following strings in an array "src=test.pgn" and src=file.pgn Thank you

    S O 2 Replies Last reply
    0
    • O omlac

      Good day How do i find every occurence of a substring that begin with a specefied set of characters and end with another set of characters eg string str = "src=test.pgn testing sub src=file.pgn find it" i want to read strings that start with src and end with .pgn in the above example i want the following strings in an array "src=test.pgn" and src=file.pgn Thank you

      S Offline
      S Offline
      Simon P Stevens
      wrote on last edited by
      #2

      You need to look into regular expressions. They are for pattern matching like this. You will need to create a regular expression to match the part of the string you are interested in, and pick out the bit in the middle. Two sites that might help you learn the basics: http://www.regular-expressions.info/dotnet.html[^] http://msdn.microsoft.com/en-us/library/hs600312.aspx[^]

      Simon

      1 Reply Last reply
      0
      • O omlac

        Good day How do i find every occurence of a substring that begin with a specefied set of characters and end with another set of characters eg string str = "src=test.pgn testing sub src=file.pgn find it" i want to read strings that start with src and end with .pgn in the above example i want the following strings in an array "src=test.pgn" and src=file.pgn Thank you

        O Offline
        O Offline
        omlac
        wrote on last edited by
        #3

        why are regular expressions so difficult to understand???????

        S 1 Reply Last reply
        0
        • O omlac

          why are regular expressions so difficult to understand???????

          S Offline
          S Offline
          Simon P Stevens
          wrote on last edited by
          #4

          :laugh: Don't worry, most people hate them too. I rarely use them, and always have to go back to the manual to check things when I need to. Post what your trying (in a new question) and maybe some reg-ex superhero can help. http://xkcd.com/208/[^]

          Simon

          O 1 Reply Last reply
          0
          • S Simon P Stevens

            :laugh: Don't worry, most people hate them too. I rarely use them, and always have to go back to the manual to check things when I need to. Post what your trying (in a new question) and maybe some reg-ex superhero can help. http://xkcd.com/208/[^]

            Simon

            O Offline
            O Offline
            omlac
            wrote on last edited by
            #5

            Thank you very much

            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