Community
    • Login

    Mark line before

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 3 Posters 646 Views 1 Watching
    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.
    • Roger St-OngeR Offline
      Roger St-Onge
      last edited by

      I have marked 2 regions in my script,

      28ebdb5f-05d6-4da5-aff1-44fcc3f3284b-image.png

      I would like to find out if there is a way to mark the line before at the same time.
      example:

      “ip_prefix”: “52.93.50.174/31”

      and

      “ip_prefix”: “52.93.193.200/32”,

      Note this is a large file from Azure IP Ranges and Service Tags – Public Cloud
      https://www.microsoft.com/en-us/download/details.aspx?id=56519

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • Alan KilbornA Offline
        Alan Kilborn @Roger St-Onge
        last edited by

        @roger-st-onge said in Mark line before:

        way to mark the line before at the same time.

        Perhaps something like this:

        Find: (?-is)"ip_prefix".*\R.*?"region"
        Search mode: regular expression

        Roger St-OngeR 1 Reply Last reply Reply Quote 3
        • Roger St-OngeR Offline
          Roger St-Onge @Alan Kilborn
          last edited by

          @alan-kilborn

          Thanks again for your help Alan :)

          Solution: (?-is)“ip_prefix”.\R.?“us-east-1”|(?-is)“ip_prefix”.\R.?“ca-central-1”
          fdd22c83-6189-498d-95a6-9a6d86ee2c07-image.png

          Output:
          6173717a-70a0-444f-9590-8ea28ac75dfb-image.png

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

            Hello, @roger-st-onge, @alan-kilborn and All,

            Instead of the regex (?-is)"ip_prefix".*\R.*?"us-east-1"|(?-is)"ip_prefix".*\R.*?"ca-central-1", you could simplify by using that one :

            MARK (?-is)^\h*"ip_prefix".+\R\h*"region": "(?:us-east|ca-central)-1",\R

            Best Regards

            guy038

            1 Reply Last reply Reply Quote 2

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors