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

regex

Scheduled Pinned Locked Moved C#
regexhelpquestioncareer
6 Posts 3 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.
  • T Offline
    T Offline
    TheCardinal
    wrote on last edited by
    #1

    need help with a regex that would split a given fullname to its corresponding first name, last name, middle initial im trying to emulate outlook's way of breaking down the full name to its corresponding fields. any regex or class to do this? help is highly appreciated.

    Life - Dreams = Job TheCardinal BenPOS Systems

    D 1 Reply Last reply
    0
    • T TheCardinal

      need help with a regex that would split a given fullname to its corresponding first name, last name, middle initial im trying to emulate outlook's way of breaking down the full name to its corresponding fields. any regex or class to do this? help is highly appreciated.

      Life - Dreams = Job TheCardinal BenPOS Systems

      D Offline
      D Offline
      dan sh
      wrote on last edited by
      #2

      If you have name as "FirstName MiddleName LastName", just split it over space. Not sure how will you manage in case first name itself contains space.

      It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD

      T 1 Reply Last reply
      0
      • D dan sh

        If you have name as "FirstName MiddleName LastName", just split it over space. Not sure how will you manage in case first name itself contains space.

        It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD

        T Offline
        T Offline
        TheCardinal
        wrote on last edited by
        #3

        thanks, that's what i did :D but the one you've pointed out thats where my problems begin :D i just really need a regex or something to really isolate what i want to be extracted and it would not matter if the user enters some of this format's. lastname, firstname mi. firstname 2ndname mi. lastname i really wanted to have a result just like how outlook used a single textbox for fullname, and breaks it down to its specific fields. i dont like to implement IF's and Switch's, i think there a better solution in splitting or extracting the fields

        Life - Dreams = Job TheCardinal BenPOS Systems

        OriginalGriffO D 2 Replies Last reply
        0
        • T TheCardinal

          thanks, that's what i did :D but the one you've pointed out thats where my problems begin :D i just really need a regex or something to really isolate what i want to be extracted and it would not matter if the user enters some of this format's. lastname, firstname mi. firstname 2ndname mi. lastname i really wanted to have a result just like how outlook used a single textbox for fullname, and breaks it down to its specific fields. i dont like to implement IF's and Switch's, i think there a better solution in splitting or extracting the fields

          Life - Dreams = Job TheCardinal BenPOS Systems

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

          I think a regex is going to be horribly complex, and even then won't work everywhere: France: M. Pierre De Gaul US: Dr M Jones Japan: Surname first? Ireland: Shaemus O'Connor

          No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones

          "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

          1 Reply Last reply
          0
          • T TheCardinal

            thanks, that's what i did :D but the one you've pointed out thats where my problems begin :D i just really need a regex or something to really isolate what i want to be extracted and it would not matter if the user enters some of this format's. lastname, firstname mi. firstname 2ndname mi. lastname i really wanted to have a result just like how outlook used a single textbox for fullname, and breaks it down to its specific fields. i dont like to implement IF's and Switch's, i think there a better solution in splitting or extracting the fields

            Life - Dreams = Job TheCardinal BenPOS Systems

            D Offline
            D Offline
            dan sh
            wrote on last edited by
            #5

            Even that will not help. If first name can have a space, why can't middle name have one? Or even the last name?

            It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD

            T 1 Reply Last reply
            0
            • D dan sh

              Even that will not help. If first name can have a space, why can't middle name have one? Or even the last name?

              It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD

              T Offline
              T Offline
              TheCardinal
              wrote on last edited by
              #6

              so whats the best way then? maybe i will just use 3 textbox separating the 3 fields and labeling then with the proper labels :D hopefully there could be a better solutions for this.

              Life - Dreams = Job TheCardinal BenPOS Systems

              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