Community
    • Login

    no next line in results?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    5 Posts 3 Posters 351 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.
    • patrickdrdP
      patrickdrd
      last edited by

      hello,
      I’ve got a playlist with lines such as:

      #EXTINF:-1 tvg-id="34kanal.ua" tvg-name="34 канал" tvg-country="UA" tvg-language="Ukrainian" tvg-logo="" group-title="",34 канал (576p)
      http://streamvideol.luxnet.ua/34ua/34ua.stream/playlist.m3u8
      #EXTINF:-1 tvg-id="34100TV.gr" tvg-name="34100 TV" tvg-country="GR" tvg-language="" tvg-logo="https://i.imgur.com/Fo1I0dt.jpg" group-title="",34100 TV (720p)
      https://s1.cystream.net/live/34100/playlist.m3u8
      #EXTINF:-1 tvg-id="" tvg-name="" tvg-country="" tvg-language="" tvg-logo="" group-title="",360
      https://turkmedya-live.ercdn.net/tv360/tv360_720p.m3u8
      
      

      and I want to select with this regexp:

      #EXTINF.*tvg-country="GR".*\R.*\R
      

      the problem is that when I double click a result, I get two lines (which is desired),
      but I see only one on the results and it isn’t convenient because I want to copy all these lines

      thanks

      patrickdrdP 1 Reply Last reply Reply Quote 0
      • patrickdrdP
        patrickdrd @patrickdrd
        last edited by

        reported here too:
        https://superuser.com/questions/1212137/in-find-result-window-of-notepad-display-multiple-line-results

        Alan KilbornA 1 Reply Last reply Reply Quote 0
        • Alan KilbornA
          Alan Kilborn @patrickdrd
          last edited by

          @patrickdrd

          First, your regex implies that you have the . matches newline box unticked. That’s just an aside for anyone else testing this.

          Second, you can’t use the Search results window for copying multline match data like you desire. As you’ve found, it only displays the first line of a multiline match.

          What you can do is use the Mark feature (Ctrl+m to bring it up), with the same regular expression, followed by pressing the Copy Marked Text command button, shown here:

          ea6c7dc6-bdba-45b8-86ea-849e714de3d8-image.png

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

            Hello, @patrickdrd and All,

            As you know, when clicking, either, on the Find All in Current Document or Find All in All Opened Documents or Find All buttons, the search process begins from the very beginning of file(s)

            So, the tip is to do an alternative search, which looks, after a complete line containing the string tvg-country="GR", for the next line, which immediately followed the previous search. This can be achieved with the \G assertion which match a zero-length location right after any previous search !

            • But this possibility must not allow to match the very first line, when, of course, no previous search has been attempted, yet ! This can be expressed with a negative look-ahead (?!\A) placed before the \G assertion, expression found out by @terry-R, some time ago !

            • In addition, we must not search for a complete second line because the \G assertion must not be immediately true in order to search, again, for a new string tvg-country="GR", first ! Thus, the correct regex to use is :

            SEARCH (?-s)#EXTINF.*tvg-country="GR".*\R|(?!\A)\G.+

            and the 3 other solutions (?-s)#EXTINF ••• \G.*, (?-s)#EXTINF ••• \G.*\R or (?-s)#EXTINF ••• \G.+\R CANNOT work !

            Note that, if an empty line immediately follows a searched line #EXTINF •••••, this empty line is not outputed in the Search results dialog ( minor drawback )


            So a generic regex, related to this example, could be :

            (?-s)^.*Expression.*\R|(?!\A)\G.+

            which displays, in the Search Results dialog, any line containing Expression and its next non-empty line


            It’s worth to point out that, if we use the Mark feature, your initial regex (?-s)^#EXTINF.*tvg-country="GR".*\R.*\R is sufficient ;-))

            Best Regards,

            guy038

            P.S :

            Just seen the @alan-kilborn solution : Nice too !

            Alan KilbornA 1 Reply Last reply Reply Quote 3
            • Alan KilbornA
              Alan Kilborn @guy038
              last edited by

              @guy038

              In light of Guy’s solution (nice one, too!), when I said earlier:

              you can’t use the Search results window for copying multline match data … it only displays the first line of a multiline match.

              This is still a true statement.

              What Guy’s solution to the problem does is create a second match.
              As this match is (somewhat) independent of the first, it DOES appear in the Search results window and thus can be copied from there, as originally desired.

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