Community

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

    Regex too find the shortest block beginning with one string and ending with a second

    Help wanted · · · – – – · · ·
    2
    2
    48
    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.
    • John Slee
      John Slee last edited by

      '''Line 1
      stuff
      '''Line 2
      more stuff
      confidential notes
      '''Line 3
      even more stuff
      
      PeterJones 1 Reply Last reply Reply Quote 0
      • PeterJones
        PeterJones @John Slee last edited by PeterJones

        @John-Slee ,

        Use the ? modifier to make an element of your regex less greedy (“find the shortest”).

        Good luck.

        ----

        Do you want regex search/replace help? Then please be patient and polite, show some effort, and be willing to learn; answer questions and requests for clarification that are made of you. All example text should be marked as plain text using the </> toolbar button or manual Markdown syntax. Screenshots can be pasted from the clipboard to your post using Ctrl+V to show graphical items, but any text should be included as literal text in your post so we can easily copy/paste your data. Show the data you have and the text you want to get from that data; include examples of things that should match and be transformed, and things that don’t match and should be left alone; show edge cases and make sure you examples are as varied as your real data. Show the regex you already tried, and why you thought it should work; tell us what’s wrong with what you do get… Read the official NPP Searching / Regex docs and the forum’s Regular Expression FAQ. If you follow these guidelines, you’re much more likely to get helpful replies that solve your problem in the shortest number of tries.

        -----
        I invoked the “Dail Critereon” for my answer

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