no next line in results?



  • 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





  • @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



  • 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 !



  • @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.


Log in to reply