• Login
Community
  • Login

Regex: Find all between strings. Select everything that is extra after `html` on the same line

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
5 Posts 2 Posters 1.1k 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.
  • R
    Robin Cruise
    last edited by Jun 2, 2021, 4:22 AM

    hi, I have this strange situation. I have a lots of line that contain links that ends with html But in some cases, I have some lines that contain more than a simple link.

    the-book-is-here.html
    yes-I-love-you.html
                     contact.html
                     continuation-of-the-last-harmony.html"><img src="frrr/flag_lsd_en.jpg" title="en" alt="en" width="28" height="19" /></a>&nbsp; create-a-beautiful-team.html
                     create-a-new-vision-of-the-art-down.html
                     the-cat-i-like-here.html
                     important-dates-here.html
    

    The output should be

    "><img src="frrr/flag_lsd_en.jpg" title="en" alt="en" width="28" height="19" /></a>&nbsp;
    

    So I must select everything that is extra after html on the same line.

    I try this regex, but are not good:

    FIND: (html)(.*?)(html)$
    REPLACE BY: \2

    1 Reply Last reply Reply Quote 0
    • G
      guy038
      last edited by guy038 Jun 2, 2021, 8:30 PM Jun 2, 2021, 8:23 PM

      Hello, @robin-cruise and All,

      Try this regex S/R :

      SEARCH (?-s)\.html.+</a>&nbsp;\K.+html$

      REPLACE Leave EMPTY


      Or, may be, this more simple one :

      SEARCH (?-s)\.html.+\K\x20.+html$

      REPLACE Leave EMPTY

      BR

      guy038

      1 Reply Last reply Reply Quote 1
      • R
        Robin Cruise
        last edited by Jun 3, 2021, 5:39 AM

        This post is deleted!
        1 Reply Last reply Reply Quote 0
        • R
          Robin Cruise
          last edited by Jun 3, 2021, 5:56 AM

          thank you @guy038 but I wanted to select something else. The regex should select exactly this line, that is framed by html tag

          "><img src="frrr/flag_lsd_en.jpg" title="en" alt="en" width="28" height="19" /></a>&nbsp;
          
          1 Reply Last reply Reply Quote 0
          • R
            Robin Cruise
            last edited by Jun 3, 2021, 7:34 PM

            SEARCH: (")(.*?;)(.*?)\s+
            REPLACE BY: \1\r

            OR

            SEARCH: (")(.*?;)(.*?)\s+
            REPLACE BY: \1\r\t\t\t\t\t

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