• Login
Community
  • Login

Search in files

Scheduled Pinned Locked Moved General Discussion
8 Posts 4 Posters 2.0k 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.
  • F
    Francisco
    last edited by Jun 29, 2020, 4:59 PM

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

    E 1 Reply Last reply Jun 29, 2020, 5:42 PM Reply Quote 0
    • E
      Ekopalypse @Francisco
      last edited by Jun 29, 2020, 5:42 PM

      @Francisco

      I guess, yes.

      1 Reply Last reply Reply Quote 1
      • G
        guy038
        last edited by guy038 Jun 30, 2020, 6:53 AM Jun 29, 2020, 8:27 PM

        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
        • F
          Francisco
          last edited by Jun 30, 2020, 2:16 AM

          Very thanks guy038, I will try

          1 Reply Last reply Reply Quote 0
          • F
            Francisco
            last edited by Jun 30, 2020, 2:27 AM

            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

            A 1 Reply Last reply Jun 30, 2020, 4:26 AM Reply Quote 0
            • A
              astrosofista @Francisco
              last edited by Jun 30, 2020, 4:26 AM

              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
              • G
                guy038
                last edited by Jun 30, 2020, 7:02 AM

                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
                • F
                  Francisco
                  last edited by Jun 30, 2020, 2:32 PM

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

                  1 Reply Last reply Reply Quote 1
                  4 out of 8
                  • First post
                    4/8
                    Last post
                  The Community of users of the Notepad++ text editor.
                  Powered by NodeBB | Contributors