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. The Lounge
  3. I might be missing something

I might be missing something

Scheduled Pinned Locked Moved The Lounge
csharpvisual-studiocomtoolsregex
37 Posts 10 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.
  • C Christian Graus

    I was replacing s=c&vl=vlg&vi=\d* with a blank string, just a space. It replaces s=c&vl=vlg&vi= and doesn't replace the digits on the end. The digits are 1-3 digits, as in s=c&vl=vlg&vi=1 s=c&vl=vlg&vi=2 s=c&vl=vlg&vi=10 s=c&vl=vlg&vi=11 s=c&vl=vlg&vi=33 s=c&vl=vlg&vi=101 etc. I'd end up with 1 2 10 11 33 101 and, of course, if I just search for that term, it finds all the matches in my file. Oh - is this a case where I need to use a greedy operator ? *doh* (Edit) I don't use regex that often, but it appears to me that my operator is fine, I don't see any alternative to use....(/Edit)

    Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

    modified on Tuesday, June 28, 2011 12:14 AM

    J Offline
    J Offline
    JustWorking
    wrote on last edited by
    #9

    Christian Graus wrote:

    s=c&vl=vlg&vi=1
    s=c&vl=vlg&vi=2
    s=c&vl=vlg&vi=10
    s=c&vl=vlg&vi=11
    s=c&vl=vlg&vi=33
    s=c&vl=vlg&vi=101

    Do you have a whitespace between the "=" & the digits?

    It’s always a pleasure to help when your efforts are appreciated...

    C 1 Reply Last reply
    0
    • J JustWorking

      Christian Graus wrote:

      s=c&vl=vlg&vi=1
      s=c&vl=vlg&vi=2
      s=c&vl=vlg&vi=10
      s=c&vl=vlg&vi=11
      s=c&vl=vlg&vi=33
      s=c&vl=vlg&vi=101

      Do you have a whitespace between the "=" & the digits?

      It’s always a pleasure to help when your efforts are appreciated...

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #10

      No, I do not. The search with the regex, matches these strings, it's the replace that skips the \d* part when it's doing the replacing.

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      J _ 2 Replies Last reply
      0
      • C Christian Graus

        I was replacing s=c&vl=vlg&vi=\d* with a blank string, just a space. It replaces s=c&vl=vlg&vi= and doesn't replace the digits on the end. The digits are 1-3 digits, as in s=c&vl=vlg&vi=1 s=c&vl=vlg&vi=2 s=c&vl=vlg&vi=10 s=c&vl=vlg&vi=11 s=c&vl=vlg&vi=33 s=c&vl=vlg&vi=101 etc. I'd end up with 1 2 10 11 33 101 and, of course, if I just search for that term, it finds all the matches in my file. Oh - is this a case where I need to use a greedy operator ? *doh* (Edit) I don't use regex that often, but it appears to me that my operator is fine, I don't see any alternative to use....(/Edit)

        Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

        modified on Tuesday, June 28, 2011 12:14 AM

        M Offline
        M Offline
        Mark_Wallace
        wrote on last edited by
        #11

        I haven't used them for a while (and they're bluddy confusing at the best of times), but if what you're replacing is s=c&vl=vlg&vi=\d*, aren't you also replacing the digits (represented by \d*)? Try deleting \d* from the end of your pattern.

        I wanna be a eunuchs developer! Pass me a bread knife!

        J 1 Reply Last reply
        0
        • C Christian Graus

          No, I do not. The search with the regex, matches these strings, it's the replace that skips the \d* part when it's doing the replacing.

          Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

          J Offline
          J Offline
          JustWorking
          wrote on last edited by
          #12

          Ok try this and give me your feedback:

          s=c&vl=vlg&vi=\d*^p$

          It’s always a pleasure to help when your efforts are appreciated...

          C 1 Reply Last reply
          0
          • M Mark_Wallace

            I haven't used them for a while (and they're bluddy confusing at the best of times), but if what you're replacing is s=c&vl=vlg&vi=\d*, aren't you also replacing the digits (represented by \d*)? Try deleting \d* from the end of your pattern.

            I wanna be a eunuchs developer! Pass me a bread knife!

            J Offline
            J Offline
            JustWorking
            wrote on last edited by
            #13

            That what he want to do he want to remove the compete segment along with the digits and he is searching and repacing but the digits are staying and not deleted...

            It’s always a pleasure to help when your efforts are appreciated...

            M 1 Reply Last reply
            0
            • C Christian Graus

              No, I do not. The search with the regex, matches these strings, it's the replace that skips the \d* part when it's doing the replacing.

              Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

              _ Offline
              _ Offline
              _Damian S_
              wrote on last edited by
              #14

              So you are having a lie down in the Lounge? :laugh: :laugh:

              Silence is golden... but duct tape is silver!! Booger Mobile - My bright green 1964 Ford Falcon - check out the blog here!! | If you feel generous - make a donation to Camp Quality!!

              C 1 Reply Last reply
              0
              • J JustWorking

                That what he want to do he want to remove the compete segment along with the digits and he is searching and repacing but the digits are staying and not deleted...

                It’s always a pleasure to help when your efforts are appreciated...

                M Offline
                M Offline
                Mark_Wallace
                wrote on last edited by
                #15

                Ah. I read it wrong.

                I wanna be a eunuchs developer! Pass me a bread knife!

                1 Reply Last reply
                0
                • _ _Damian S_

                  So you are having a lie down in the Lounge? :laugh: :laugh:

                  Silence is golden... but duct tape is silver!! Booger Mobile - My bright green 1964 Ford Falcon - check out the blog here!! | If you feel generous - make a donation to Camp Quality!!

                  C Offline
                  C Offline
                  Christian Graus
                  wrote on last edited by
                  #16

                  Calvin was practicing drums, and I was waiting on the other end of hte house for him to finish...

                  Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                  J 1 Reply Last reply
                  0
                  • C Christian Graus

                    Calvin was practicing drums, and I was waiting on the other end of hte house for him to finish...

                    Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                    J Offline
                    J Offline
                    JustWorking
                    wrote on last edited by
                    #17

                    Christian Graus wrote:

                    I was waiting on the other end of hte house for him to finish...

                    FTFY :laugh:

                    It’s always a pleasure to help when your efforts are appreciated...

                    _ 1 Reply Last reply
                    0
                    • J JustWorking

                      Ok try this and give me your feedback:

                      s=c&vl=vlg&vi=\d*^p$

                      It’s always a pleasure to help when your efforts are appreciated...

                      C Offline
                      C Offline
                      Christian Graus
                      wrote on last edited by
                      #18

                      This will not find my values until I remove the ^p and the $. Removing one or the other, still does not work. The number is NOT the end of the line, there's usually a " just after it, and then tons of other stuff. I am replacing URLs. Just to add, s=c&vl=vlg&vi=\d*" works to match the line with the quotes in Expresso, but not in Visual Studio.

                      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                      J 1 Reply Last reply
                      0
                      • J JustWorking

                        Christian Graus wrote:

                        I was waiting on the other end of hte house for him to finish...

                        FTFY :laugh:

                        It’s always a pleasure to help when your efforts are appreciated...

                        _ Offline
                        _ Offline
                        _Damian S_
                        wrote on last edited by
                        #19

                        JustWorking wrote:

                        Christian Graus wrote:

                        I was waiting on the other end of hte house for him to finish...

                        FTFY :laugh:

                        No you didn't!!

                        Silence is golden... but duct tape is silver!! Booger Mobile - My bright green 1964 Ford Falcon - check out the blog here!! | If you feel generous - make a donation to Camp Quality!!

                        J 1 Reply Last reply
                        0
                        • C Christian Graus

                          This will not find my values until I remove the ^p and the $. Removing one or the other, still does not work. The number is NOT the end of the line, there's usually a " just after it, and then tons of other stuff. I am replacing URLs. Just to add, s=c&vl=vlg&vi=\d*" works to match the line with the quotes in Expresso, but not in Visual Studio.

                          Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                          J Offline
                          J Offline
                          JustWorking
                          wrote on last edited by
                          #20

                          What framework you are using?

                          It’s always a pleasure to help when your efforts are appreciated...

                          C 1 Reply Last reply
                          0
                          • J JustWorking

                            What framework you are using?

                            It’s always a pleasure to help when your efforts are appreciated...

                            C Offline
                            C Offline
                            Christian Graus
                            wrote on last edited by
                            #21

                            Well, it shouldn't matter, I am doing this in the IDE, not in code. I am using search and replace within Visual Studio. It should work the same no matter what I use. I am editing HTML files.

                            Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                            J 1 Reply Last reply
                            0
                            • _ _Damian S_

                              JustWorking wrote:

                              Christian Graus wrote:

                              I was waiting on the other end of hte house for him to finish...

                              FTFY :laugh:

                              No you didn't!!

                              Silence is golden... but duct tape is silver!! Booger Mobile - My bright green 1964 Ford Falcon - check out the blog here!! | If you feel generous - make a donation to Camp Quality!!

                              J Offline
                              J Offline
                              JustWorking
                              wrote on last edited by
                              #22

                              _Damian S_ wrote:

                              JustWorking wrote:

                              Christian Graus wrote:

                              I was waiting on the other end of
                              hte house for him to finish...

                              FTFY :laugh:

                              No you didn't!!

                              Yes I did :laugh: I cought Christian saying hte :laugh: Now we shell call him Mr. hte ;P

                              It’s always a pleasure to help when your efforts are appreciated...

                              _ 1 Reply Last reply
                              0
                              • C Christian Graus

                                Well, it shouldn't matter, I am doing this in the IDE, not in code. I am using search and replace within Visual Studio. It should work the same no matter what I use. I am editing HTML files.

                                Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                                J Offline
                                J Offline
                                JustWorking
                                wrote on last edited by
                                #23

                                Ok try this:

                                s=c&vl=vlg&vi=[0-9]*

                                It’s always a pleasure to help when your efforts are appreciated...

                                C 1 Reply Last reply
                                0
                                • J JustWorking

                                  Ok try this:

                                  s=c&vl=vlg&vi=[0-9]*

                                  It’s always a pleasure to help when your efforts are appreciated...

                                  C Offline
                                  C Offline
                                  Christian Graus
                                  wrote on last edited by
                                  #24

                                  Nope - it's obviously the same thing, and it does the same. Matches the numbers fine, but leaves them behind when I replace.

                                  Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                                  J 1 Reply Last reply
                                  0
                                  • C Christian Graus

                                    Nope - it's obviously the same thing, and it does the same. Matches the numbers fine, but leaves them behind when I replace.

                                    Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                                    J Offline
                                    J Offline
                                    JustWorking
                                    wrote on last edited by
                                    #25

                                    How are you replacing? post the code here

                                    It’s always a pleasure to help when your efforts are appreciated...

                                    C 1 Reply Last reply
                                    0
                                    • C Christian Graus

                                      If I were to use regex at all in the replacement string, I'd be doing a capture in the search and using the captured object in the replacement, which is one level of difficulty above what I was trying to do.

                                      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

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

                                      Sorry - I see I misread your requirement - I thought you DIDN'T want to replace the numbers!

                                      MVVM# - See how I did MVVM my way ___________________________________________ Man, you're a god. - walterhevedeich 26/05/2011 .\\axxx (That's an 'M')

                                      C 1 Reply Last reply
                                      0
                                      • J JustWorking

                                        How are you replacing? post the code here

                                        It’s always a pleasure to help when your efforts are appreciated...

                                        C Offline
                                        C Offline
                                        Christian Graus
                                        wrote on last edited by
                                        #27

                                        There is no code. CTRL-Shift-H. Replace dialog in visual studio.

                                        Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                                        J 1 Reply Last reply
                                        0
                                        • C Christian Graus

                                          There is no code. CTRL-Shift-H. Replace dialog in visual studio.

                                          Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                                          J Offline
                                          J Offline
                                          JustWorking
                                          wrote on last edited by
                                          #28

                                          Christian Graus wrote:

                                          CTRL-Shift-H. Replace dialog in visual studio.

                                          :omg: you can't do that, its not dynamic it is static so you have to do it one by one

                                          It’s always a pleasure to help when your efforts are appreciated...

                                          C 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