Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Search in files

    General Discussion
    4
    8
    97
    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.
    • Francisco
      Francisco last edited by

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

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

        @Francisco

        I guess, yes.

        1 Reply Last reply Reply Quote 1
        • guy038
          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
          • Francisco
            Francisco last edited by

            Very thanks guy038, I will try

            1 Reply Last reply Reply Quote 0
            • Francisco
              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

              astrosofista 1 Reply Last reply Reply Quote 0
              • astrosofista
                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
                • guy038
                  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
                  • Francisco
                    Francisco last edited by

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

                    1 Reply Last reply Reply Quote 1
                    • First post
                      Last post
                    Copyright © 2014 NodeBB Forums | Contributors