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#
regexhelpquestion
12 Posts 3 Posters 2 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.
  • L Offline
    L Offline
    lawrenceinba
    wrote on last edited by
    #1

    given input: DNo:12,Crystal Building,ghn O M R Road;5 e c r road; c/o r v rao reversing the string: oar v r o/c ;daor r c e 5;daoR R M O nhg,gnidliuB latsyrC,21:oND the reverse input string is passed to REGEX pattern string str1 = Regex.Replace(g, @"(?<=^|,|;|#|&|.)([^0-9]) (?=[^0-9](?:=| |;|#|&|,|#|$))", "$1"); obtained output after reversing: DNo:12,Crystal Building,ghn OMRRoad;5 ecrroad; c/o rvrao required output is: DNo:12,Crystal Building,ghn OMR Road;5 ecr road; c/o rv rao anybody can fix this simple error.. thank you

    the quieter u become more u hear

    G 1 Reply Last reply
    0
    • L lawrenceinba

      given input: DNo:12,Crystal Building,ghn O M R Road;5 e c r road; c/o r v rao reversing the string: oar v r o/c ;daor r c e 5;daoR R M O nhg,gnidliuB latsyrC,21:oND the reverse input string is passed to REGEX pattern string str1 = Regex.Replace(g, @"(?<=^|,|;|#|&|.)([^0-9]) (?=[^0-9](?:=| |;|#|&|,|#|$))", "$1"); obtained output after reversing: DNo:12,Crystal Building,ghn OMRRoad;5 ecrroad; c/o rvrao required output is: DNo:12,Crystal Building,ghn OMR Road;5 ecr road; c/o rv rao anybody can fix this simple error.. thank you

      the quieter u become more u hear

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      That's what I was asking for. A real example of what you were actually trying to do instead of a lot of made up examples that didn't resemble any real data. (?<= )(\w) (?=\w )

      Despite everything, the person most likely to be fooling you next is yourself.

      L 1 Reply Last reply
      0
      • G Guffa

        That's what I was asking for. A real example of what you were actually trying to do instead of a lot of made up examples that didn't resemble any real data. (?<= )(\w) (?=\w )

        Despite everything, the person most likely to be fooling you next is yourself.

        L Offline
        L Offline
        lawrenceinba
        wrote on last edited by
        #3

        that didnt work out... what i need is 1. it should merge only single characters 2. but should not merge numeric values. only alphabets should be merged 3. also should stop if delimers are found (!@#$&;') can you help me

        the quieter u become more u hear

        G 1 Reply Last reply
        0
        • L lawrenceinba

          that didnt work out... what i need is 1. it should merge only single characters 2. but should not merge numeric values. only alphabets should be merged 3. also should stop if delimers are found (!@#$&;') can you help me

          the quieter u become more u hear

          G Offline
          G Offline
          Guffa
          wrote on last edited by
          #4

          Ok, do you have any example where it doesn't work? This is the output you required: DNo:12,Crystal Building,ghn OMR Road;5 ecr road; c/o rv rao And this is the output that I got (copied straight from the console): DNo:12,Crystal Building,ghn OMR Road;5 ecr road; c/o rv rao That looks pretty identical to me...

          Despite everything, the person most likely to be fooling you next is yourself.

          L 1 Reply Last reply
          0
          • G Guffa

            Ok, do you have any example where it doesn't work? This is the output you required: DNo:12,Crystal Building,ghn OMR Road;5 ecr road; c/o rv rao And this is the output that I got (copied straight from the console): DNo:12,Crystal Building,ghn OMR Road;5 ecr road; c/o rv rao That looks pretty identical to me...

            Despite everything, the person most likely to be fooling you next is yourself.

            L Offline
            L Offline
            lawrenceinba
            wrote on last edited by
            #5

            this example doesnt work out DNo:12,Crystal Building,ghn O M R Road;5 e c r road; c/o r v rao if found the solution kindly send me the pattern which you are using

            the quieter u become more u hear

            G 1 Reply Last reply
            0
            • L lawrenceinba

              this example doesnt work out DNo:12,Crystal Building,ghn O M R Road;5 e c r road; c/o r v rao if found the solution kindly send me the pattern which you are using

              the quieter u become more u hear

              G Offline
              G Offline
              Guffa
              wrote on last edited by
              #6

              That's exactly the input that I was using. It's working just fine, and I already posted the pattern that I was using.

              Despite everything, the person most likely to be fooling you next is yourself.

              L 1 Reply Last reply
              0
              • G Guffa

                That's exactly the input that I was using. It's working just fine, and I already posted the pattern that I was using.

                Despite everything, the person most likely to be fooling you next is yourself.

                L Offline
                L Offline
                lawrenceinba
                wrote on last edited by
                #7

                "DNo:12,Crystal Building,ghn O M R Road; 5 e c r road; c/o r g rao"; that bold part alone has errors it shows 5ecr... i told you numeric values should not be included even if it is single... could u fix it out thanks for your help

                the quieter u become more u hear

                G 1 Reply Last reply
                0
                • L lawrenceinba

                  "DNo:12,Crystal Building,ghn O M R Road; 5 e c r road; c/o r g rao"; that bold part alone has errors it shows 5ecr... i told you numeric values should not be included even if it is single... could u fix it out thanks for your help

                  the quieter u become more u hear

                  G Offline
                  G Offline
                  Guffa
                  wrote on last edited by
                  #8

                  lawrenceinba wrote:

                  that bold part alone has errors it shows 5ecr...

                  No, it doesn't. Look at the output that I posted.

                  Despite everything, the person most likely to be fooling you next is yourself.

                  L 1 Reply Last reply
                  0
                  • G Guffa

                    lawrenceinba wrote:

                    that bold part alone has errors it shows 5ecr...

                    No, it doesn't. Look at the output that I posted.

                    Despite everything, the person most likely to be fooling you next is yourself.

                    L Offline
                    L Offline
                    lawrenceinba
                    wrote on last edited by
                    #9

                    please try this input "DNo:12,Crystal Building, behind O M R Road; 5 e c r road; c/o r g rao" the output merges 5ecr

                    the quieter u become more u hear

                    L G 2 Replies Last reply
                    0
                    • L lawrenceinba

                      please try this input "DNo:12,Crystal Building, behind O M R Road; 5 e c r road; c/o r g rao" the output merges 5ecr

                      the quieter u become more u hear

                      L Offline
                      L Offline
                      Luc Pattyn
                      wrote on last edited by
                      #10

                      great conversation, keep it up! :laugh:

                      Luc Pattyn [Forum Guidelines] [My Articles]


                      - before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets


                      1 Reply Last reply
                      0
                      • L lawrenceinba

                        please try this input "DNo:12,Crystal Building, behind O M R Road; 5 e c r road; c/o r g rao" the output merges 5ecr

                        the quieter u become more u hear

                        G Offline
                        G Offline
                        Guffa
                        wrote on last edited by
                        #11

                        Yes, that does give a different output. Use this pattern: (?<= )([A-Za-z]) (?=[A-Za-z] )

                        Despite everything, the person most likely to be fooling you next is yourself.

                        L 1 Reply Last reply
                        0
                        • G Guffa

                          Yes, that does give a different output. Use this pattern: (?<= )([A-Za-z]) (?=[A-Za-z] )

                          Despite everything, the person most likely to be fooling you next is yourself.

                          L Offline
                          L Offline
                          lawrenceinba
                          wrote on last edited by
                          #12

                          thank you very much... that works very well :) :) :) :) :)

                          the quieter u become more u hear

                          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