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.
  • 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
                  • J JustWorking

                    _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...

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

                    JustWorking wrote:

                    cought

                    Just so you know... it's caught!!

                    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!!

                    1 Reply Last reply
                    0
                    • J JustWorking

                      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 Offline
                      C Offline
                      Christian Graus
                      wrote on last edited by
                      #30

                      Wow - so the regex search and replace is useless then ? Great. Thanks for helping me. Do you have any link that explains why they didn't bother to make this useful at all ?

                      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
                      • L Lost User

                        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 Offline
                        C Offline
                        Christian Graus
                        wrote on last edited by
                        #31

                        No, I hoped I could use regex to replace a bunch of SIMILAR strings with the same value.

                        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.

                        1 Reply 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

                          A Offline
                          A Offline
                          AspDotNetDev
                          wrote on last edited by
                          #32

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

                          Christian Graus wrote:

                          Oh - is this a case where I need to use a greedy operator ? *doh*

                          Searches should be greedy by default (maybe not in Visual Studio). In C#, ? will make it non-greedy.

                          Driven to the ARMs by x86.

                          1 Reply Last reply
                          0
                          • C Christian Graus

                            Wow - so the regex search and replace is useless then ? Great. Thanks for helping me. Do you have any link that explains why they didn't bother to make this useful at all ?

                            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
                            #33

                            It is called Find and Replace no search and replace :doh:

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

                            1 Reply Last reply
                            0
                            • C Christian Graus

                              Wow - so the regex search and replace is useless then ? Great. Thanks for helping me. Do you have any link that explains why they didn't bother to make this useful at all ?

                              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
                              #34

                              I would love to see some green between mu posts :rolleyes:

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

                              1 Reply Last reply
                              0
                              • C Christian Graus

                                But isn't it counter intuitive that if I do a search and replace using regex, the regex portion of what I find, is not replaced ? Ooops - 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.

                                S Offline
                                S Offline
                                Slacker007
                                wrote on last edited by
                                #35

                                JGSoft - Regex Magic: works wonders. Don't leave home with out it.

                                try {
                                if (Regex.IsMatch(subjectString, "")) {
                                // Successful match
                                } else {
                                // Match attempt failed
                                }
                                } catch (ArgumentException ex) {
                                // Syntax error in the regular expression
                                }

                                ----------------------------- Just along for the ride. -----------------------------

                                1 Reply Last reply
                                0
                                • D Dr Walt Fair PE

                                  Not really. I looked up "search" and "replace" and sure enough, they are different concepts in Ameriglish. Not sure about Austraglish, though. I love the way good editors like vi let you search for something and replace something else. It's saved me lots of time and effort on many an occasion.

                                  CQ de W5ALT

                                  Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software

                                  J Offline
                                  J Offline
                                  JimmyRopes
                                  wrote on last edited by
                                  #36

                                  That is because vi uses grep.

                                  Simply Elegant Designs JimmyRopes Designs
                                  Think inside the box! ProActive Secure Systems
                                  I'm on-line therefore I am. JimmyRopes

                                  1 Reply 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

                                    J Offline
                                    J Offline
                                    JimmyRopes
                                    wrote on last edited by
                                    #37

                                    Got me. It looks like it should work. :confused: PS - I don't know why you were 1 voted on your previous post so I voted 5 to counteract, not because I thought it was a brilliant post.

                                    Simply Elegant Designs JimmyRopes Designs
                                    Think inside the box! ProActive Secure Systems
                                    I'm on-line therefore I am. JimmyRopes

                                    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