Community
    • Login

    Search in files

    Scheduled Pinned Locked Moved General Discussion
    8 Posts 4 Posters 2.5k Views
    Loading More Posts
    • 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.
    • FranciscoF Offline
      Francisco
      last edited by

      Hello, can I do a file search (Ctrl + Shift + F) of two words on the same line? thanks.

      EkopalypseE 1 Reply Last reply Reply Quote 0
      • EkopalypseE Offline
        Ekopalypse @Francisco
        last edited by

        @Francisco

        I guess, yes.

        1 Reply Last reply Reply Quote 1
        • guy038G Online
          guy038
          last edited by guy038

          Hello, @francisco and All,

          A short example :

          Let’s suppose you’re looking for all the lines of all files, in a specific directory, containing, both, the two strings You and there

          Three questions arise :

          • Do you mind the case of the strings or not ( YOU, There, yoU, THEre, … )

          • Do you mind if the strings You and there are true words or part of words like Your and therefore ?

          • Does the string You always come before the string there or the opposite or both situations may occur ?


          So, here are 4 regular expressions for each case. Note that I suppose that, both, word_1 or word_2 may occur first, in current line :

          • Regex A : (?-is)You.*there|there.*You for a search of strings You and there, with this exact case

          • Regex B : (?i-s)You.*there|there.*You for a search of strings You and there, whatever their case

          • Regex C : (?-is)\bYou\b.*\bthere\b|\bthere\b.*\bYou\b for a search of words You and there, with this exact case

          • Regex D : (?i-s)\bYou\b.*\bthere\b|\bthere\b.*\bYou\b for a search of words You and there, whatever their case

          Of course, you must select the Regular expression search mode

          The (?-s) in-line modifier ensures that the regex engine will interpret the dot ( . ) as matching a single standard character and not the line-break chars !

          Hope this helps :-)

          Best Regards,

          guy038

          1 Reply Last reply Reply Quote 2
          • FranciscoF Offline
            Francisco
            last edited by

            Very thanks guy038, I will try

            1 Reply Last reply Reply Quote 0
            • FranciscoF Offline
              Francisco
              last edited by

              Please, guyo38, help me, I have a file with some lines: I need to do a search for 144 and JU44…
              144 FX 2020-06-13 1427 PU3LJY GG67 PMVUV FG67
              144 FT 2020-06-13 1741 PL4JYU GG68 PH7NS HG68
              144 FO 2020-06-13 1752 PM2LJY GG77 PD9MM JU44

              astrosofistaA 1 Reply Last reply Reply Quote 0
              • astrosofistaA Offline
                astrosofista @Francisco
                last edited by

                Hi @Francisco,

                I think you will get what you want if you replace “You” with “144” and “there” with “JU44” in @guy038’s third Regular Expression, above.

                Take care.

                1 Reply Last reply Reply Quote 1
                • guy038G Online
                  guy038
                  last edited by

                  Hi, @francisco and All,

                  Yes, as @astrosofista said, I suppose that you need the regex C of my previous post :

                  Thus, in your case, the regex becomes (?-is)\b144\b.*\bJU44\b

                  Note that I even shortened this regex as the number 144 comes before the word JU44 !

                  Best Regards

                  guy038

                  1 Reply Last reply Reply Quote 1
                  • FranciscoF Offline
                    Francisco
                    last edited by

                    Now sucess, very thanks guy038 and all… Take care.

                    1 Reply Last reply Reply Quote 1

                    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                    With your input, this post could be even better 💗

                    Register Login
                    • First post
                      Last post
                    The Community of users of the Notepad++ text editor.
                    Powered by NodeBB | Contributors