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. Word vs. RegExp

Word vs. RegExp

Scheduled Pinned Locked Moved The Lounge
visual-studioquestion
33 Posts 13 Posters 3 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.
  • B Bassam Abdul Baki

    It's never worked for searching multiple lines of text.

    N Offline
    N Offline
    Nish Nishant
    wrote on last edited by
    #7

    Bassam Abdul-Baki wrote:

    It's never worked for searching multiple lines of text.

    Never worked for you? Test this code out:

        static void Main()
        {
            string text = @"Line 1
    

    Line 2
    This
    is what
    I need to
    find.
    Line 3
    Line 4.";

            Regex regex = new Regex("This\\r\\nis what\\r\\nI need to\\r\\nfind.", RegexOptions.Multiline);
            Console.WriteLine(regex.IsMatch(text)); // outputs true as expected
        }
    

    Regards, Nish


    Most recent article : Adding data-bindable attributes to C# enums using the dynamic runtime My technology blog: voidnish.wordpress.com

    B 1 Reply Last reply
    0
    • N Nish Nishant

      Bassam Abdul-Baki wrote:

      It's never worked for searching multiple lines of text.

      Never worked for you? Test this code out:

          static void Main()
          {
              string text = @"Line 1
      

      Line 2
      This
      is what
      I need to
      find.
      Line 3
      Line 4.";

              Regex regex = new Regex("This\\r\\nis what\\r\\nI need to\\r\\nfind.", RegexOptions.Multiline);
              Console.WriteLine(regex.IsMatch(text)); // outputs true as expected
          }
      

      Regards, Nish


      Most recent article : Adding data-bindable attributes to C# enums using the dynamic runtime My technology blog: voidnish.wordpress.com

      B Offline
      B Offline
      Bassam Abdul Baki
      wrote on last edited by
      #8

      My bad. I never meant programmatically. I was talking about the free RegExp tools out there that I've seen. None of them allow me to search for multiline text.

      N S OriginalGriffO D L 7 Replies Last reply
      0
      • B Bassam Abdul Baki

        My bad. I never meant programmatically. I was talking about the free RegExp tools out there that I've seen. None of them allow me to search for multiline text.

        N Offline
        N Offline
        Nish Nishant
        wrote on last edited by
        #9

        Bassam Abdul-Baki wrote:

        My bad. I never meant programmatically. I was talking about the free RegExp tools out there that I've seen. None of them allow me to search for multiline text.

        Ah okay. That's a tool limitation then. Not a RegExp issue :-) It's quite likely that Word internally uses RegExps anyway.

        Regards, Nish


        Most recent article : Adding data-bindable attributes to C# enums using the dynamic runtime My technology blog: voidnish.wordpress.com

        B 1 Reply Last reply
        0
        • B Bassam Abdul Baki

          My bad. I never meant programmatically. I was talking about the free RegExp tools out there that I've seen. None of them allow me to search for multiline text.

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

          Pay the nominal license fee and get RegEx Buddy[^]. I use it all the time at home and at work. HTH

          B 1 Reply Last reply
          0
          • N Nish Nishant

            Bassam Abdul-Baki wrote:

            My bad. I never meant programmatically. I was talking about the free RegExp tools out there that I've seen. None of them allow me to search for multiline text.

            Ah okay. That's a tool limitation then. Not a RegExp issue :-) It's quite likely that Word internally uses RegExps anyway.

            Regards, Nish


            Most recent article : Adding data-bindable attributes to C# enums using the dynamic runtime My technology blog: voidnish.wordpress.com

            B Offline
            B Offline
            Bassam Abdul Baki
            wrote on last edited by
            #11

            Yeah, but most of these tools support the RegExp syntax, but not multilines. All of the free tools I've seen are great in almost every way, but this. Maybe I should start paying for stuff? :)

            Mike HankeyM A 2 Replies Last reply
            0
            • S Slacker007

              Pay the nominal license fee and get RegEx Buddy[^]. I use it all the time at home and at work. HTH

              B Offline
              B Offline
              Bassam Abdul Baki
              wrote on last edited by
              #12

              Slacker007 wrote:

              Pay

              What's that?

              1 Reply Last reply
              0
              • B Bassam Abdul Baki

                My bad. I never meant programmatically. I was talking about the free RegExp tools out there that I've seen. None of them allow me to search for multiline text.

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

                Bassam Abdul-Baki wrote:

                I was talking about the free

                That's your first problem. IMHO, "most" FREE stuff is crap and if it isn't crap then it is very limited in what it does. I don't have time for many limitations...do you? :)

                B 1 Reply Last reply
                0
                • S Slacker007

                  Bassam Abdul-Baki wrote:

                  I was talking about the free

                  That's your first problem. IMHO, "most" FREE stuff is crap and if it isn't crap then it is very limited in what it does. I don't have time for many limitations...do you? :)

                  B Offline
                  B Offline
                  Bassam Abdul Baki
                  wrote on last edited by
                  #14

                  My wallet and I disagree on many levels.

                  S H 2 Replies Last reply
                  0
                  • B Bassam Abdul Baki

                    My bad. I never meant programmatically. I was talking about the free RegExp tools out there that I've seen. None of them allow me to search for multiline text.

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

                    Depending on what kind of regex tool you are looking for, have a look at these: Expresso[^] - helps you design, examine and test regexes. PsPad[^] - programmers editor which includes full Regex searching if you turn it on.

                    Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."

                    "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

                    B 1 Reply Last reply
                    0
                    • B Bassam Abdul Baki

                      My wallet and I disagree on many levels.

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

                      You can afford Microsoft Word and other more expensive software that you have at your disposal (I'm sure) but you can't shell out the 40 bucks for RegEx Buddy? Well, I can't help you there; that's your call. Just so you know, I'm not rich either but I'm not going to let 40 measly dollars stop me from getting the job done. Good luck to you. ;) [edit] You could try Expresso mentioned by OG below. It's free and it does search multiple lines but I don't know if it actually searches files on your computer based on your search criteria. I have used it before but it is not as powerful as RegEx Buddy. Again, my personal opinion.

                      B D 2 Replies Last reply
                      0
                      • B Bassam Abdul Baki

                        My bad. I never meant programmatically. I was talking about the free RegExp tools out there that I've seen. None of them allow me to search for multiline text.

                        D Offline
                        D Offline
                        Dan Neely
                        wrote on last edited by
                        #17

                        That's because the regex library used by ~99% of windows applications is a severely limited pile of garbage.

                        3x12=36 2x12=24 1x12=12 0x12=18

                        B 1 Reply Last reply
                        0
                        • S Slacker007

                          You can afford Microsoft Word and other more expensive software that you have at your disposal (I'm sure) but you can't shell out the 40 bucks for RegEx Buddy? Well, I can't help you there; that's your call. Just so you know, I'm not rich either but I'm not going to let 40 measly dollars stop me from getting the job done. Good luck to you. ;) [edit] You could try Expresso mentioned by OG below. It's free and it does search multiple lines but I don't know if it actually searches files on your computer based on your search criteria. I have used it before but it is not as powerful as RegEx Buddy. Again, my personal opinion.

                          B Offline
                          B Offline
                          Bassam Abdul Baki
                          wrote on last edited by
                          #18

                          I can afford forty bucks. However, if my company won't pay for it, I'm not going to buy it. It's the principle. :)

                          S 1 Reply Last reply
                          0
                          • B Bassam Abdul Baki

                            I can afford forty bucks. However, if my company won't pay for it, I'm not going to buy it. It's the principle. :)

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

                            My company wouldn't buy it for me either so I had to. I hear you about the principle. :)

                            1 Reply Last reply
                            0
                            • OriginalGriffO OriginalGriff

                              Depending on what kind of regex tool you are looking for, have a look at these: Expresso[^] - helps you design, examine and test regexes. PsPad[^] - programmers editor which includes full Regex searching if you turn it on.

                              Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."

                              B Offline
                              B Offline
                              Bassam Abdul Baki
                              wrote on last edited by
                              #20

                              I've used PsPad. Didn't see a way to search multiline and I didn't find a RegExp section in their Settings.

                              OriginalGriffO 1 Reply Last reply
                              0
                              • D Dan Neely

                                That's because the regex library used by ~99% of windows applications is a severely limited pile of garbage.

                                3x12=36 2x12=24 1x12=12 0x12=18

                                B Offline
                                B Offline
                                Bassam Abdul Baki
                                wrote on last edited by
                                #21

                                Great, so which 1% do you recommend?

                                D 1 Reply Last reply
                                0
                                • B Bassam Abdul Baki

                                  I've used PsPad. Didn't see a way to search multiline and I didn't find a RegExp section in their Settings.

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

                                  My mistake - multiline doesn't work in PsPad - I thought it did. Regex is enabled in the Search/Replace box by the checkbox labelled "Regular Expressions"

                                  Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."

                                  "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

                                  B 1 Reply Last reply
                                  0
                                  • B Bassam Abdul Baki

                                    Yeah, but most of these tools support the RegExp syntax, but not multilines. All of the free tools I've seen are great in almost every way, but this. Maybe I should start paying for stuff? :)

                                    Mike HankeyM Offline
                                    Mike HankeyM Offline
                                    Mike Hankey
                                    wrote on last edited by
                                    #23

                                    Try Expresso[^] Free and awesome.

                                    Semper Fi http://www.hq4thmarinescomm.com[^]
                                    www.jaxcoder.com[^] WinHeist - Windows Electronic Inventory SysTem

                                    1 Reply Last reply
                                    0
                                    • OriginalGriffO OriginalGriff

                                      My mistake - multiline doesn't work in PsPad - I thought it did. Regex is enabled in the Search/Replace box by the checkbox labelled "Regular Expressions"

                                      Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."

                                      B Offline
                                      B Offline
                                      Bassam Abdul Baki
                                      wrote on last edited by
                                      #24

                                      Yeah, I saw that. But I thought since I wasn't seeing it, there must be another setting somewhere. Good to know I'm not crazy.

                                      1 Reply Last reply
                                      0
                                      • B Bassam Abdul Baki

                                        Yeah, but most of these tools support the RegExp syntax, but not multilines. All of the free tools I've seen are great in almost every way, but this. Maybe I should start paying for stuff? :)

                                        A Offline
                                        A Offline
                                        Andy Brummer
                                        wrote on last edited by
                                        #25

                                        Like Mike said Expresso rocks.

                                        Curvature of the Mind now with 3D

                                        1 Reply Last reply
                                        0
                                        • B Bassam Abdul Baki

                                          Great, so which 1% do you recommend?

                                          D Offline
                                          D Offline
                                          Dan Neely
                                          wrote on last edited by
                                          #26

                                          I don't. My preferred editor is in the 99%. A few years ago after testing about 30-40 windows text editors I found on that had a reasonably sane UI (ie not emacs and not vim), and a fully functional regex engine; however the frequency with which that mattered (3x12=36 2x12=24 1x12=12 0x12=18

                                          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