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. Regular Expressions
  4. Regular Expression To Extract Everything Including the String And Before The First Space Character

Regular Expression To Extract Everything Including the String And Before The First Space Character

Scheduled Pinned Locked Moved Regular Expressions
regexquestion
9 Posts 2 Posters 14 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.
  • M Offline
    M Offline
    Member_14572415
    wrote on last edited by
    #1

    Hi all, I have a string "Gender: Female Race: American Asian". I would like to extract the following substring from this string. "Gender: Female" Any suggestions how I could accomplish this? Thanks, Ana

    L 1 Reply Last reply
    0
    • M Member_14572415

      Hi all, I have a string "Gender: Female Race: American Asian". I would like to extract the following substring from this string. "Gender: Female" Any suggestions how I could accomplish this? Thanks, Ana

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

      How about making a little effort yourself now we have shown you how to do it? And I also gave you a link yesterday where you can try out lots of different samples.

      M 3 Replies Last reply
      0
      • L Lost User

        How about making a little effort yourself now we have shown you how to do it? And I also gave you a link yesterday where you can try out lots of different samples.

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

        Okay, thanks. I will use the link that you posted to try out some samples.

        1 Reply Last reply
        0
        • L Lost User

          How about making a little effort yourself now we have shown you how to do it? And I also gave you a link yesterday where you can try out lots of different samples.

          M Offline
          M Offline
          Member_14572415
          wrote on last edited by
          #4

          Hi Richard, I am using your link in one of your earlier posts for the regex tool. However, I am not able to sign in. Any help would be appreciated. Thanks, Ana

          L 1 Reply Last reply
          0
          • M Member_14572415

            Hi Richard, I am using your link in one of your earlier posts for the regex tool. However, I am not able to sign in. Any help would be appreciated. Thanks, Ana

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

            You do not need to sign in. Just use the what you see.

            M 2 Replies Last reply
            0
            • L Lost User

              You do not need to sign in. Just use the what you see.

              M Offline
              M Offline
              Member_14572415
              wrote on last edited by
              #6

              Thanks.

              1 Reply Last reply
              0
              • L Lost User

                You do not need to sign in. Just use the what you see.

                M Offline
                M Offline
                Member_14572415
                wrote on last edited by
                #7

                Hi Richard, I was able to extract the intended substring by using "Gender: (.+?)". Thanks for all of your help! Ana

                1 Reply Last reply
                0
                • L Lost User

                  How about making a little effort yourself now we have shown you how to do it? And I also gave you a link yesterday where you can try out lots of different samples.

                  M Offline
                  M Offline
                  Member_14572415
                  wrote on last edited by
                  #8

                  Hi, I went to the link "https://regexr.com/. However, I have not been able to figure out how to use it. Is there any documentation available for reference? Thanks, Ana

                  L 1 Reply Last reply
                  0
                  • M Member_14572415

                    Hi, I went to the link "https://regexr.com/. However, I have not been able to figure out how to use it. Is there any documentation available for reference? Thanks, Ana

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

                    Yes, the documentation is right there on the front page. You put your own test data into the box labelled "Text". Then add your regex in the box titled "Expression". The menus on the left point you to the documentation for all the regex types. What could be simpler?

                    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