Community
    • Login

    Is it possible to use REGEX find/replace to copy search term to the begining of multiple lines until a new match is found

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    15 Posts 5 Posters 1.5k 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.
    • Brian Crosby 0B
      Brian Crosby 0 @Terry R
      last edited by Brian Crosby 0

      @Terry-R

      Still getting confused with this - the structure for the look ahead just is not making sense to me.

      I’ve figured out how to concatenate the WWPNs and move the Zone Name either to the end of that line, or the line below. However trying to emulate what you referenced for the look ahead eludes me. (Also new to this side and the markup doesn’t make a lot of sense, so my apologies when I fail to input data as you are expecting to see it)

      The sample that “seems” to be relevant to my needs would be
      (?-si:BSR|(?!\A)\G)(?s-i:(?!ESR).)*?\K(?-si:FR)

      The problem I am having now is that I think I need to be able to capture the BSR and the ESR so I can replace then in corrected order (or I am not understanding the logic applied).

      I can find the individual elements, but when I try to combine them at all NPP (and REGEX101) just say “nope, that doesn’t work”.

      So, for data set (concatenated lines with Zone on single lines)

      f05018fe3a800600;f05018fe3a800604;f05018fe3a800608;f05018fe3a80060c;f05018fe3a800610;f05018fe3a800614;f05018fe3a800618;f05018fe3a80061c"f05018fe3a800620;f05018fe3a800624;f05018fe3a800628;f05018fe3a80062c;f05018fe3a800630;f05018fe3a800634;f05018fe3a800638;f05018fe3a80063c"f05018fe3a800640;f05018fe3a800644;f05018fe3a800648;f05018fe3a80064c;f05018fe3a800650;f05018fe3a800654;f05018fe3a800658;f05018fe3a80065c"f05018fe3a800660;f05018fe3a800664;f05018fe3a800668;f05018fe3a80066c;f05018fe3a800670;f05018fe3a800674;f05018fe3a800678;f05018fe3a80067c"f05018fe3a800680;f05018fe3a800684;f05018fe3a800688;f05018fe3a80068c;f05018fe3a800690;f05018fe3a800694;f05018fe3a800698;f05018fe3a80069c"f05018fe3a8006a0;f05018fe3a8006a4;f05018fe3a8006a8;f05018fe3a8006ac;f05018fe3a8006b0;f05018fe3a8006b4;f05018fe3a8006b8;f05018fe3a8006bc"f05018fe3a8006c0;f05018fe3a8006c4;f05018fe3a8006c8;f05018fe3a8006cc;f05018fe3a8006d0;f05018fe3a8006d4;f05018fe3a8006d8;f05018fe3a8006dc"f05018fe3a8006e0;f05018fe3a8006e4;f05018fe3a8006e8;f05018fe3a8006ec;f05018fe3a8006f0;f05018fe3a8006f4;f05018fe3a8006f8;f05018fe3a8006fc"LS30FCP_VLXPDC03_F0_E123L_E123K_E123X_1000_103F

      f05018fe3a801800;f05018fe3a801804;f05018fe3a801808;f05018fe3a80180c;f05018fe3a801810;f05018fe3a801814;f05018fe3a801818;f05018fe3a80181c"f05018fe3a801820;f05018fe3a801824;f05018fe3a801828;f05018fe3a80182c;f05018fe3a801830;f05018fe3a801834;f05018fe3a801838;f05018fe3a80183c"f05018fe3a801840;f05018fe3a801844;f05018fe3a801848;f05018fe3a80184c;f05018fe3a801850;f05018fe3a801854;f05018fe3a801858;f05018fe3a80185c"f05018fe3a801860;f05018fe3a801864;f05018fe3a801868;f05018fe3a80186c;f05018fe3a801870;f05018fe3a801874;f05018fe3a801878;f05018fe3a80187c"f05018fe3a801880;f05018fe3a801884;f05018fe3a801888;f05018fe3a80188c;f05018fe3a801890;f05018fe3a801894;f05018fe3a801898;f05018fe3a80189c"f05018fe3a8018a0;f05018fe3a8018a4;f05018fe3a8018a8;f05018fe3a8018ac;f05018fe3a8018b0;f05018fe3a8018b4;f05018fe3a8018b8;f05018fe3a8018bc"f05018fe3a8018c0;f05018fe3a8018c4;f05018fe3a8018c8;f05018fe3a8018cc;f05018fe3a8018d0;f05018fe3a8018d4;f05018fe3a8018d8;f05018fe3a8018dc"f05018fe3a8018e0;f05018fe3a8018e4;f05018fe3a8018e8;f05018fe3a8018ec;f05018fe3a8018f0;f05018fe3a8018f4;f05018fe3a8018f8;f05018fe3a8018fc"LS30FCP_VLXPDC03_F4_E123L_E123K_E123X_2000_203F

      hat’s two lines of data with 64 WWPNs a \t and the Zone name.

      My “standard” is I use 8 WWPNs (first 7 with “;” as delimiters plus a " as the end of line as that is the command structure for the script
      I can find a set of them with (?-si:[0-9A-Fa-f]{16}|(?!\A)\G).*?"
      I can also find the zone name with (?:\w{2}[0-9a-f]{2}FCP\w+)

      If each of those captured at the same time, the “logic” I would want to apply is $2\t$1\r\n letting NPP replace each of those instances so the would have a data set that looks like:

      LS30FCP_VLXPDC03_F0_E123L_E123K_E123X_1000_103F f05018fe3a800600;f05018fe3a800604;f05018fe3a800608;f05018fe3a80060c;f05018fe3a800610;f05018fe3a800614;f05018fe3a800618;f05018fe3a80061c"

      LS30FCP_VLXPDC03_F0_E123L_E123K_E123X_1000_103F f05018fe3a800620;f05018fe3a800624;f05018fe3a800628;f05018fe3a80062c;f05018fe3a800630;f05018fe3a800634;f05018fe3a800638;f05018fe3a80063c"

      LS30FCP_VLXPDC03_F0_E123L_E123K_E123X_1000_103F f05018fe3a800640;f05018fe3a800644;f05018fe3a800648;f05018fe3a80064c;f05018fe3a800650;f05018fe3a800654;f05018fe3a800658;f05018fe3a80065c"

      LS30FCP_VLXPDC03_F0_E123L_E123K_E123X_1000_103F f05018fe3a800660;f05018fe3a800664;f05018fe3a800668;f05018fe3a80066c;f05018fe3a800670;f05018fe3a800674;f05018fe3a800678;f05018fe3a80067c"

      LS30FCP_VLXPDC03_F0_E123L_E123K_E123X_1000_103F f05018fe3a800680;f05018fe3a800684;f05018fe3a800688;f05018fe3a80068c;f05018fe3a800690;f05018fe3a800694;f05018fe3a800698;f05018fe3a80069c"

      LS30FCP_VLXPDC03_F0_E123L_E123K_E123X_1000_103F f05018fe3a8006a0;f05018fe3a8006a4;f05018fe3a8006a8;f05018fe3a8006ac;f05018fe3a8006b0;f05018fe3a8006b4;f05018fe3a8006b8;f05018fe3a8006bc"

      LS30FCP_VLXPDC03_F0_E123L_E123K_E123X_1000_103F f05018fe3a8006c0;f05018fe3a8006c4;f05018fe3a8006c8;f05018fe3a8006cc;f05018fe3a8006d0;f05018fe3a8006d4;f05018fe3a8006d8;f05018fe3a8006dc"

      LS30FCP_VLXPDC03_F0_E123L_E123K_E123X_1000_103F f05018fe3a8006e0;f05018fe3a8006e4;f05018fe3a8006e8;f05018fe3a8006ec;f05018fe3a8006f0;f05018fe3a8006f4;f05018fe3a8006f8;f05018fe3a8006fc"

      LS30FCP_VLXPDC03_F0_E123L_E123K_E123X_1000_103F

      LS30FCP_VLXPDC03_F4_E123L_E123K_E123X_2000_203Ff05018fe3a801800;f05018fe3a801804;f05018fe3a801808;f05018fe3a80180c;f05018fe3a801810;f05018fe3a801814;f05018fe3a801818;f05018fe3a80181c"

      LS30FCP_VLXPDC03_F4_E123L_E123K_E123X_2000_203Ff05018fe3a801820;f05018fe3a801824;f05018fe3a801828;f05018fe3a80182c;f05018fe3a801830;f05018fe3a801834;f05018fe3a801838;f05018fe3a80183c"

      LS30FCP_VLXPDC03_F4_E123L_E123K_E123X_2000_203Ff05018fe3a801840;f05018fe3a801844;f05018fe3a801848;f05018fe3a80184c;f05018fe3a801850;f05018fe3a801854;f05018fe3a801858;f05018fe3a80185c"

      LS30FCP_VLXPDC03_F4_E123L_E123K_E123X_2000_203Ff05018fe3a801860;f05018fe3a801864;f05018fe3a801868;f05018fe3a80186c;f05018fe3a801870;f05018fe3a801874;f05018fe3a801878;f05018fe3a80187c"

      LS30FCP_VLXPDC03_F4_E123L_E123K_E123X_2000_203Ff05018fe3a801880;f05018fe3a801884;f05018fe3a801888;f05018fe3a80188c;f05018fe3a801890;f05018fe3a801894;f05018fe3a801898;f05018fe3a80189c"

      LS30FCP_VLXPDC03_F4_E123L_E123K_E123X_2000_203Ff05018fe3a8018a0;f05018fe3a8018a4;f05018fe3a8018a8;f05018fe3a8018ac;f05018fe3a8018b0;f05018fe3a8018b4;f05018fe3a8018b8;f05018fe3a8018bc"

      LS30FCP_VLXPDC03_F4_E123L_E123K_E123X_2000_203Ff05018fe3a8018c0;f05018fe3a8018c4;f05018fe3a8018c8;f05018fe3a8018cc;f05018fe3a8018d0;f05018fe3a8018d4;f05018fe3a8018d8;f05018fe3a8018dc"

      LS30FCP_VLXPDC03_F4_E123L_E123K_E123X_2000_203Ff05018fe3a8018e0;f05018fe3a8018e4;f05018fe3a8018e8;f05018fe3a8018ec;f05018fe3a8018f0;f05018fe3a8018f4;f05018fe3a8018f8;f05018fe3a8018fc"

      LS30FCP_VLXPDC03_F4_E123L_E123K_E123X_2000_203F

      If I could get to that point with REGEX, I can get rid of lines with just the zone names easily enough and complete the other find/replace to complete the command structures.

      My biggest issue is finding references for the lookahead that make sense to me in context of how I need to move the data around. All the stuff I’ve found are more simplistic inline edits like the examples to delete or replace single characters.

      Thank you for all the help you’ve provided so far! I’m still new to using what I consider more advance REGEX use cases…

      Going to keep banging my head on this now -

      Terry RT Alan KilbornA PeterJonesP 4 Replies Last reply Reply Quote 0
      • Terry RT
        Terry R @Brian Crosby 0
        last edited by

        @Brian-Crosby-0 said in Is it possible to use REGEX find/replace to copy search term to the begining of multiple lines until a new match is found:

        Also new to this side and the markup doesn’t make a lot of sense, so my apologies when I fail to input data as you are expecting to see it

        I would have thought it is quite simple to input data in the manner requested. You add it to the posting window, then select that example data and you can click on the </> button immediately above the posting window.

        If you want some help with the actual data that’s the way we need it, otherwise we aren’t entirely sure what you show is exactly how it’s represented in real life as the posting engine will interpret the data and possibly alter it otherwise.

        What is the char(s) that represent the end of line (in the original), is it the ; (comma)?

        Terry

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

          @Brian-Crosby-0 said in Is it possible to use REGEX find/replace to copy search term to the begining of multiple lines until a new match is found:

          (and REGEX101)

          I’d take regex101 with a grain of salt.
          For basic regex, sure, yea, it’s all fine and Notepad++ will behave the same way.
          However, when you get into some fancier regex features, it could be different, as Notepad++ uses a different regular expression engine.
          I’m not sure anything here would qualify as “fancier”…but just be advised.

          1 Reply Last reply Reply Quote 1
          • PeterJonesP
            PeterJones @Brian Crosby 0
            last edited by PeterJones

            @Brian-Crosby-0 said in Is it possible to use REGEX find/replace to copy search term to the begining of multiple lines until a new match is found:

            Also new to this side and the markup doesn’t make a lot of sense, so my apologies when I fail to input data as you are expecting to see it

            Useful References

            • Please Read Before Posting
            • Template for Search/Replace Questions
            • Formatting Forum Posts
            • Notepad++ Online User Manual: Searching/Regex
            • FAQ: Where to find other regular expressions (regex) documentation

            The sample that “seems” to be relevant to my needs would be
            (?-si:BSR|(?!\A)\G)(?s-i:(?!ESR).)*?\K(?-si:FR)

            The problem I am having now is that I think I need to be able to capture the BSR and the ESR so I can replace then in corrected order (or I am not understanding the logic applied).

            If you want to capture the BSR and ESR, just add another set of paren around each … though that would change it so that the FR ends up in group#3 instead of group#1

            But be warned: if your search region were defined by BSR={ and ESR=}, and you wanted to match FR=x, on the data { x y x }, on the first match, the BSR would be captured, but on the second match, because of the \G, there would not be anything saved in the BSR for the second match. So I don’t think that will do what you want.

            I think you need to re-read Terry’s post about making this a multi-step process. The lookahead for step#3 just needs to use the lookahead to find the ZONENAME at the end of the line, and the actual match is used to find the right location to copy the ZONENAME, possibly multiple times.

            PeterJonesP 1 Reply Last reply Reply Quote 1
            • PeterJonesP
              PeterJones @PeterJones
              last edited by PeterJones

              I said :

              I think you need to re-read Terry’s post about making this a multi-step process. The lookahead for step#3 just needs to use the lookahead to find the ZONENAME at the end of the line, and the actual match is used to find the right location to copy the ZONENAME, possibly multiple times.

              Here’s an example, using simpler data. (Since, as Terry said, your lack of hitting the </> button makes it impossible for us to trust the data that we see in your posts. And because with a simpler version, you may understand the concepts better, so that you can apply them not only to this problem, but to similar problems in the future)

              Dummy Data:

              ZONE1
              line 1
              line 2
              line 3
              
              ZONE2
              line A
              line B
              line C
              

              Step 1: concatenate:

              ZONE1
              ☺line 1☺line 2☺line 3
              ZONE2
              ☺line A☺line B☺line C
              

              Step 2: Move the zonename to the end of the following line:

              ☺line 1☺line 2☺line 3☹ZONE1
              ☺line A☺line B☺line C☹ZONE2
              

              Step 3: lookahead to do a s+r to insert the zonename in every location you want it:

              • FIND = (?<=☺)(?=.*☹(.*$)) – find the position following a smiley; grab everything following the frown
              • REPLACE = ${1}: – replace the zero-width position after the smiley with the stuff after the frown (ie, the zonename) followed by a colon
              ☺ZONE1:line 1☺ZONE1:line 2☺ZONE1:line 3☹ZONE1
              ☺ZONE2:line A☺ZONE2:line B☺ZONE2:line C☹ZONE2
              

              Step 4: repeat until end of file => that’s the same as REPLACE ALL

              Step 5: final clean:

              • FIND = ☹(.*$)
                REPLACE = empty box
              • FIND = ^☺
                REPLACE = empty box
              • FIND = ☺
                REPLACE = \r\n
              Brian Crosby 0B 1 Reply Last reply Reply Quote 3
              • Terry RT
                Terry R @Brian Crosby 0
                last edited by

                @Brian-Crosby-0 said in Is it possible to use REGEX find/replace to copy search term to the begining of multiple lines until a new match is found:

                My biggest issue is finding references for the lookahead that make sense to me in context of how I need to move the data around. All the stuff I’ve found are more simplistic inline edits like the examples to delete or replace single characters.

                I am going out on a limb here. In spite of saying we need the data via the </> method I have continued a bit. But you do need to submit the data in the correct method. I won’t guarantee my regex will work, but maybe it will guide you further along in your process.

                Find What:(?-s)^(([^"])+")(?|(?=.+"([^"]+)$)|([^"]+$))
                Replace With:${3}\t${1}\r\n

                I don’t know how advanced you are with regex, but you will likely not have run into “branch reset” yet (?|. @guy038 has given a small discourse in it some time ago (post #23640). This is however been a saviour in this case as it manages to fix the last set because the lookahead will fail (on purpose) leaving the “other branch” to pick the trailing zone name and move it to the front. You can enter my Find What code into regex101.com and it will explain it, otherwise ask away here.

                In the small test I completed, I wasn’t sure that the result is exactly what you needed, so again you may have to alter a bit to suit.

                Good luck
                Terry

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

                  Hello, @brian-crosby-0, @terry-r, @peterjones, @alan-kilborn and All,

                  @brian-crosby-0, as you forget to place all your data as text, I don’t understand very well the very first steps of your pruning !

                  You should use this icon in order that we see your exact text !

                  df14b914-5ad6-4a8b-a3da-2978eff92ac3-Capture d’écran 2022-03-07 123711.png


                  Anyway, let’s start with the INPUT text below, which contains 7 zonenames, followed with a variable amount of lines containing 16 hexadecimal digits ( from 5 to 31 lines )

                  AA7aFCPAAAAA
                  4d5a900304ffffb8
                  09cd21b8014ccd21
                  6772616d2063616e
                  756e20696e20444f
                  0d0a24e935c2b8ad
                  XY3dFCPAAAAA
                  54aceb19c85debbf
                  54aceb19c85eebb3
                  54aceb960aafeab5
                  54aceb960aa8ea88
                  54aceba42c3feb8c
                  55aceb3a0aa9ead6
                  54acebad543bebb7
                  54aceb52696368ad
                  ef3eed5fe002010b
                  1410e01940100205
                  612e024081101010
                  2360cb0afe2d901c
                  DH9bFCPAAAAA
                  54ea1e18f8e91e40
                  74f4cf1910d01904
                  da7107e0197207d4
                  38ac016021844621
                  480f102310ca2140
                  02da2140c02e7273
                  0adc2140402e7265
                  01a82c4042558bec
                  50a120a26133c550
                  64de62e87fbf12c7
                  da59e802171483c4
                  8be55dc3cccccccc
                  cccccc558bec6aff
                  20a26133c5508d45
                  62e81fbf12c745fc
                  e8a2161483c40c8b
                  5dc3cccccccccccc
                  ccb984df62e83608
                  07506884045ab984
                  a384df62e89a5d68
                  c3cccccccccccccc
                  8bec6aff683a8358
                  c5508d45f464a3b9
                  c0c705d8df6250c7
                  6884045ac705dcdf
                  a3c8df62e8145dc7
                  59e8b4151483c404
                  e55dc3cc558bec6a
                  a120a26133c5508d
                  e834070433c0c705
                  c705ec636107c705
                  ZKd5FCPAAAAA
                  8945fcb9f06361e8
                  61c705046461c705
                  66a3f06361c645fc
                  0433c0c705186461
                  646107c705186461
                  02b9206461e87b06
                  c705346461c70534
                  66a3206461c645fc
                  c745fcffffffff68
                  c4048b4df464890d
                  cccccccccccccc55
                  64a150a120a26133
                  0268e0df62e88fbc
                  68a0dc59e8121414
                  4010010e1fba0eb4
                  546869732070726f
                  6e6f742062652072
                  53206d6f64652e0d
                  54acebad54acebad
                  54aceb19c85feb07
                  54aceb33f46beba8
                  54aceb960aa9ead7
                  54aceba42c2febae
                  54acebad54adeb4e
                  54aceb3f0a53ebac
                  54aceb3a0aaeeaac
                  54aceb50454c0107
                  010ed01954157031
                  01010501602f04fb
                  QBbbFCPAAAAA
                  1010a42721540130
                  2e085401a0e91e54
                  e01994072e746578
                  20602e7264617461
                  1940402e64617461
                  40c02e6766696473
                  402e746c73092023
                  726360cb0a3023cc
                  6c6f630854012e56
                  6aff683a3b5864a1
                  VAc7FCPAAAAA
                  8d45f464a36a0268
                  45fcffffffff68d0
                  0c8b4df464890d59
                  cccccccccccccccc
                  686a3b5864a150a1
                  f464a36a026834de
                  ffffffff6820db59
                  4df464890d598be5
                  cccccccccccccccc
                  0433c0c70598df62
                  df62c70594df6266
                  a0db59e841161459
                  cccccccccccccc55
                  64a150a120a26133
                  c8df62e8c4070433
                  05dcdf62b9c8df62
                  6207c705d8df6266
                  45fcffffffff68dc
                  8b4df464890d598b
                  ff6888835864a150
                  45f464a3b9d86361
                  e86361c705ec6361
                  e8636166a3d86361
                  f7060433c0c70564
                  MY03FCPAAAAA
                  04646107c7056461
                  01b9086461e8b906
                  c7051c6461c7051c
                  66a3086461c645fc
                  0433c0c705306461
                  646107c705306461
                  03c7053864610101
                  90dc59e86d141483
                  598be55dc3cccccc
                  8bec6aff68ba8358
                  c5508d45f464a36a
                  12c745fcffffffff
                  83c40c8b4df46489
                  

                  With the first regex S/R, below, we add a double quote character right above any zonename line, if current line is not empty OR after the very last line of hexadecimal contents :

                  • SEARCH (?xi-s) (?<= . ) (?= \R \w{2} [[:xdigit:]]{2} FCP ) | (?<= ^ [[:xdigit:]]{16} ) \Z

                  • REPLACE "

                  AA7aFCPAAAAA
                  4d5a900304ffffb8
                  09cd21b8014ccd21
                  6772616d2063616e
                  756e20696e20444f
                  0d0a24e935c2b8ad"
                  XY3dFCPAAAAA
                  54aceb19c85debbf
                  54aceb19c85eebb3
                  54aceb960aafeab5
                  54aceb960aa8ea88
                  54aceba42c3feb8c
                  55aceb3a0aa9ead6
                  54acebad543bebb7
                  54aceb52696368ad
                  ef3eed5fe002010b
                  1410e01940100205
                  612e024081101010
                  2360cb0afe2d901c"
                  DH9bFCPAAAAA
                  54ea1e18f8e91e40
                  74f4cf1910d01904
                  da7107e0197207d4
                  38ac016021844621
                  480f102310ca2140
                  02da2140c02e7273
                  0adc2140402e7265
                  01a82c4042558bec
                  50a120a26133c550
                  64de62e87fbf12c7
                  da59e802171483c4
                  8be55dc3cccccccc
                  cccccc558bec6aff
                  20a26133c5508d45
                  62e81fbf12c745fc
                  e8a2161483c40c8b
                  5dc3cccccccccccc
                  ccb984df62e83608
                  07506884045ab984
                  a384df62e89a5d68
                  c3cccccccccccccc
                  8bec6aff683a8358
                  c5508d45f464a3b9
                  c0c705d8df6250c7
                  6884045ac705dcdf
                  a3c8df62e8145dc7
                  59e8b4151483c404
                  e55dc3cc558bec6a
                  a120a26133c5508d
                  e834070433c0c705
                  c705ec636107c705"
                  ZKd5FCPAAAAA
                  8945fcb9f06361e8
                  61c705046461c705
                  66a3f06361c645fc
                  0433c0c705186461
                  646107c705186461
                  02b9206461e87b06
                  c705346461c70534
                  66a3206461c645fc
                  c745fcffffffff68
                  c4048b4df464890d
                  cccccccccccccc55
                  64a150a120a26133
                  0268e0df62e88fbc
                  68a0dc59e8121414
                  4010010e1fba0eb4
                  546869732070726f
                  6e6f742062652072
                  53206d6f64652e0d
                  54acebad54acebad
                  54aceb19c85feb07
                  54aceb33f46beba8
                  54aceb960aa9ead7
                  54aceba42c2febae
                  54acebad54adeb4e
                  54aceb3f0a53ebac
                  54aceb3a0aaeeaac
                  54aceb50454c0107
                  010ed01954157031
                  01010501602f04fb"
                  QBbbFCPAAAAA
                  1010a42721540130
                  2e085401a0e91e54
                  e01994072e746578
                  20602e7264617461
                  1940402e64617461
                  40c02e6766696473
                  402e746c73092023
                  726360cb0a3023cc
                  6c6f630854012e56
                  6aff683a3b5864a1"
                  VAc7FCPAAAAA
                  8d45f464a36a0268
                  45fcffffffff68d0
                  0c8b4df464890d59
                  cccccccccccccccc
                  686a3b5864a150a1
                  f464a36a026834de
                  ffffffff6820db59
                  4df464890d598be5
                  cccccccccccccccc
                  0433c0c70598df62
                  df62c70594df6266
                  a0db59e841161459
                  cccccccccccccc55
                  64a150a120a26133
                  c8df62e8c4070433
                  05dcdf62b9c8df62
                  6207c705d8df6266
                  45fcffffffff68dc
                  8b4df464890d598b
                  ff6888835864a150
                  45f464a3b9d86361
                  e86361c705ec6361
                  e8636166a3d86361
                  f7060433c0c70564"
                  MY03FCPAAAAA
                  04646107c7056461
                  01b9086461e8b906
                  c7051c6461c7051c
                  66a3086461c645fc
                  0433c0c705306461
                  646107c705306461
                  03c7053864610101
                  90dc59e86d141483
                  598be55dc3cccccc
                  8bec6aff68ba8358
                  c5508d45f464a36a
                  12c745fcffffffff
                  83c40c8b4df46489"
                  

                  With the second regex S/R, below, we replace any line, containing exactly 16 hexadecimal digits followed by its line-break, by these hexa digits, followed with a semicolon character

                  • SEARCH (?xi) ( [[:xdigit:]]{16} ) \R

                  • REPLACE \1;

                  AA7aFCPAAAAA
                  4d5a900304ffffb8;09cd21b8014ccd21;6772616d2063616e;756e20696e20444f;0d0a24e935c2b8ad"
                  XY3dFCPAAAAA
                  54aceb19c85debbf;54aceb19c85eebb3;54aceb960aafeab5;54aceb960aa8ea88;54aceba42c3feb8c;55aceb3a0aa9ead6;54acebad543bebb7;54aceb52696368ad;ef3eed5fe002010b;1410e01940100205;612e024081101010;2360cb0afe2d901c"
                  DH9bFCPAAAAA
                  54ea1e18f8e91e40;74f4cf1910d01904;da7107e0197207d4;38ac016021844621;480f102310ca2140;02da2140c02e7273;0adc2140402e7265;01a82c4042558bec;50a120a26133c550;64de62e87fbf12c7;da59e802171483c4;8be55dc3cccccccc;cccccc558bec6aff;20a26133c5508d45;62e81fbf12c745fc;e8a2161483c40c8b;5dc3cccccccccccc;ccb984df62e83608;07506884045ab984;a384df62e89a5d68;c3cccccccccccccc;8bec6aff683a8358;c5508d45f464a3b9;c0c705d8df6250c7;6884045ac705dcdf;a3c8df62e8145dc7;59e8b4151483c404;e55dc3cc558bec6a;a120a26133c5508d;e834070433c0c705;c705ec636107c705"
                  ZKd5FCPAAAAA
                  8945fcb9f06361e8;61c705046461c705;66a3f06361c645fc;0433c0c705186461;646107c705186461;02b9206461e87b06;c705346461c70534;66a3206461c645fc;c745fcffffffff68;c4048b4df464890d;cccccccccccccc55;64a150a120a26133;0268e0df62e88fbc;68a0dc59e8121414;4010010e1fba0eb4;546869732070726f;6e6f742062652072;53206d6f64652e0d;54acebad54acebad;54aceb19c85feb07;54aceb33f46beba8;54aceb960aa9ead7;54aceba42c2febae;54acebad54adeb4e;54aceb3f0a53ebac;54aceb3a0aaeeaac;54aceb50454c0107;010ed01954157031;01010501602f04fb"
                  QBbbFCPAAAAA
                  1010a42721540130;2e085401a0e91e54;e01994072e746578;20602e7264617461;1940402e64617461;40c02e6766696473;402e746c73092023;726360cb0a3023cc;6c6f630854012e56;6aff683a3b5864a1"
                  VAc7FCPAAAAA
                  8d45f464a36a0268;45fcffffffff68d0;0c8b4df464890d59;cccccccccccccccc;686a3b5864a150a1;f464a36a026834de;ffffffff6820db59;4df464890d598be5;cccccccccccccccc;0433c0c70598df62;df62c70594df6266;a0db59e841161459;cccccccccccccc55;64a150a120a26133;c8df62e8c4070433;05dcdf62b9c8df62;6207c705d8df6266;45fcffffffff68dc;8b4df464890d598b;ff6888835864a150;45f464a3b9d86361;e86361c705ec6361;e8636166a3d86361;f7060433c0c70564"
                  MY03FCPAAAAA
                  04646107c7056461;01b9086461e8b906;c7051c6461c7051c;66a3086461c645fc;0433c0c705306461;646107c705306461;03c7053864610101;90dc59e86d141483;598be55dc3cccccc;8bec6aff68ba8358;c5508d45f464a36a;12c745fcffffffff;83c40c8b4df46489"
                  

                  Finally, with this third regex S/R, below, we replace, in any line ending with a double-quote char, any group of two hexadecimal digits, when followed with an hexadecimal digit, by this same group, followed with a colon character

                  • SEARCH (?xi-s)(?= .+ " $ ) ( [[:xdigit:]]{2} ) (?= [[:xdigit:]] )

                  • REPLACE \1:

                  AA7aFCPAAAAA
                  4d:5a:90:03:04:ff:ff:b8;09:cd:21:b8:01:4c:cd:21;67:72:61:6d:20:63:61:6e;75:6e:20:69:6e:20:44:4f;0d:0a:24:e9:35:c2:b8:ad"
                  XY3dFCPAAAAA
                  54:ac:eb:19:c8:5d:eb:bf;54:ac:eb:19:c8:5e:eb:b3;54:ac:eb:96:0a:af:ea:b5;54:ac:eb:96:0a:a8:ea:88;54:ac:eb:a4:2c:3f:eb:8c;55:ac:eb:3a:0a:a9:ea:d6;54:ac:eb:ad:54:3b:eb:b7;54:ac:eb:52:69:63:68:ad;ef:3e:ed:5f:e0:02:01:0b;14:10:e0:19:40:10:02:05;61:2e:02:40:81:10:10:10;23:60:cb:0a:fe:2d:90:1c"
                  DH9bFCPAAAAA
                  54:ea:1e:18:f8:e9:1e:40;74:f4:cf:19:10:d0:19:04;da:71:07:e0:19:72:07:d4;38:ac:01:60:21:84:46:21;48:0f:10:23:10:ca:21:40;02:da:21:40:c0:2e:72:73;0a:dc:21:40:40:2e:72:65;01:a8:2c:40:42:55:8b:ec;50:a1:20:a2:61:33:c5:50;64:de:62:e8:7f:bf:12:c7;da:59:e8:02:17:14:83:c4;8b:e5:5d:c3:cc:cc:cc:cc;cc:cc:cc:55:8b:ec:6a:ff;20:a2:61:33:c5:50:8d:45;62:e8:1f:bf:12:c7:45:fc;e8:a2:16:14:83:c4:0c:8b;5d:c3:cc:cc:cc:cc:cc:cc;cc:b9:84:df:62:e8:36:08;07:50:68:84:04:5a:b9:84;a3:84:df:62:e8:9a:5d:68;c3:cc:cc:cc:cc:cc:cc:cc;8b:ec:6a:ff:68:3a:83:58;c5:50:8d:45:f4:64:a3:b9;c0:c7:05:d8:df:62:50:c7;68:84:04:5a:c7:05:dc:df;a3:c8:df:62:e8:14:5d:c7;59:e8:b4:15:14:83:c4:04;e5:5d:c3:cc:55:8b:ec:6a;a1:20:a2:61:33:c5:50:8d;e8:34:07:04:33:c0:c7:05;c7:05:ec:63:61:07:c7:05"
                  ZKd5FCPAAAAA
                  89:45:fc:b9:f0:63:61:e8;61:c7:05:04:64:61:c7:05;66:a3:f0:63:61:c6:45:fc;04:33:c0:c7:05:18:64:61;64:61:07:c7:05:18:64:61;02:b9:20:64:61:e8:7b:06;c7:05:34:64:61:c7:05:34;66:a3:20:64:61:c6:45:fc;c7:45:fc:ff:ff:ff:ff:68;c4:04:8b:4d:f4:64:89:0d;cc:cc:cc:cc:cc:cc:cc:55;64:a1:50:a1:20:a2:61:33;02:68:e0:df:62:e8:8f:bc;68:a0:dc:59:e8:12:14:14;40:10:01:0e:1f:ba:0e:b4;54:68:69:73:20:70:72:6f;6e:6f:74:20:62:65:20:72;53:20:6d:6f:64:65:2e:0d;54:ac:eb:ad:54:ac:eb:ad;54:ac:eb:19:c8:5f:eb:07;54:ac:eb:33:f4:6b:eb:a8;54:ac:eb:96:0a:a9:ea:d7;54:ac:eb:a4:2c:2f:eb:ae;54:ac:eb:ad:54:ad:eb:4e;54:ac:eb:3f:0a:53:eb:ac;54:ac:eb:3a:0a:ae:ea:ac;54:ac:eb:50:45:4c:01:07;01:0e:d0:19:54:15:70:31;01:01:05:01:60:2f:04:fb"
                  QBbbFCPAAAAA
                  10:10:a4:27:21:54:01:30;2e:08:54:01:a0:e9:1e:54;e0:19:94:07:2e:74:65:78;20:60:2e:72:64:61:74:61;19:40:40:2e:64:61:74:61;40:c0:2e:67:66:69:64:73;40:2e:74:6c:73:09:20:23;72:63:60:cb:0a:30:23:cc;6c:6f:63:08:54:01:2e:56;6a:ff:68:3a:3b:58:64:a1"
                  VAc7FCPAAAAA
                  8d:45:f4:64:a3:6a:02:68;45:fc:ff:ff:ff:ff:68:d0;0c:8b:4d:f4:64:89:0d:59;cc:cc:cc:cc:cc:cc:cc:cc;68:6a:3b:58:64:a1:50:a1;f4:64:a3:6a:02:68:34:de;ff:ff:ff:ff:68:20:db:59;4d:f4:64:89:0d:59:8b:e5;cc:cc:cc:cc:cc:cc:cc:cc;04:33:c0:c7:05:98:df:62;df:62:c7:05:94:df:62:66;a0:db:59:e8:41:16:14:59;cc:cc:cc:cc:cc:cc:cc:55;64:a1:50:a1:20:a2:61:33;c8:df:62:e8:c4:07:04:33;05:dc:df:62:b9:c8:df:62;62:07:c7:05:d8:df:62:66;45:fc:ff:ff:ff:ff:68:dc;8b:4d:f4:64:89:0d:59:8b;ff:68:88:83:58:64:a1:50;45:f4:64:a3:b9:d8:63:61;e8:63:61:c7:05:ec:63:61;e8:63:61:66:a3:d8:63:61;f7:06:04:33:c0:c7:05:64"
                  MY03FCPAAAAA
                  04:64:61:07:c7:05:64:61;01:b9:08:64:61:e8:b9:06;c7:05:1c:64:61:c7:05:1c;66:a3:08:64:61:c6:45:fc;04:33:c0:c7:05:30:64:61;64:61:07:c7:05:30:64:61;03:c7:05:38:64:61:01:01;90:dc:59:e8:6d:14:14:83;59:8b:e5:5d:c3:cc:cc:cc;8b:ec:6a:ff:68:ba:83:58;c5:50:8d:45:f4:64:a3:6a;12:c7:45:fc:ff:ff:ff:ff;83:c4:0c:8b:4d:f4:64:89"
                  

                  I suppose that this OUTPUT is your expected one ?

                  Of course, the zonename line may be followed by any amount of lines with 16 hexadecimal lines !

                  Best Regards,

                  guy038

                  1 Reply Last reply Reply Quote 1
                  • Brian Crosby 0B
                    Brian Crosby 0 @PeterJones
                    last edited by

                    @PeterJones said in Is it possible to use REGEX find/replace to copy search term to the begining of multiple lines until a new match is found:

                    Peter - This was the one that finally put it over the top for me.

                    • FIND = (?<=☺)(?=.*☹(.*$)) – find the position following a smiley; grab everything following the frown
                    • REPLACE = ${1}: – replace the zero-width position after the smiley with the stuff after the frown

                    To recap the complete solution in case anyone following behind wants to follow the bouncing ball:

                    Example Data Set:

                    DC30FCP_VLXPDC03_F0_E123L_E123K_E123X_1000_103F			
                    VLXPDC03	f0	1000	ac920af293100600
                    VLXPDC03	f0	1001	ac920af293100604
                    VLXPDC03	f0	1002	ac920af293100608
                    VLXPDC03	f0	1003	ac920af29310060c
                    VLXPDC03	f0	1004	ac920af293100610
                    VLXPDC03	f0	1005	ac920af293100614
                    VLXPDC03	f0	1006	ac920af293100618
                    VLXPDC03	f0	1007	ac920af29310061c
                    VLXPDC03	f0	1008	ac920af293100620
                    VLXPDC03	f0	1009	ac920af293100624
                    VLXPDC03	f0	100a	ac920af293100628
                    VLXPDC03	f0	100b	ac920af29310062c
                    VLXPDC03	f0	100c	ac920af293100630
                    VLXPDC03	f0	100d	ac920af293100634
                    VLXPDC03	f0	100e	ac920af293100638
                    VLXPDC03	f0	100f	ac920af29310063c
                    VLXPDC03	f0	1010	ac920af293100640
                    VLXPDC03	f0	1011	ac920af293100644
                    VLXPDC03	f0	1012	ac920af293100648
                    VLXPDC03	f0	1013	ac920af29310064c
                    VLXPDC03	f0	1014	ac920af293100650
                    VLXPDC03	f0	1015	ac920af293100654
                    VLXPDC03	f0	1016	ac920af293100658
                    VLXPDC03	f0	1017	ac920af29310065c
                    VLXPDC03	f0	1018	ac920af293100660
                    VLXPDC03	f0	1019	ac920af293100664
                    VLXPDC03	f0	101a	ac920af293100668
                    VLXPDC03	f0	101b	ac920af29310066c
                    VLXPDC03	f0	101c	ac920af293100670
                    VLXPDC03	f0	101d	ac920af293100674
                    VLXPDC03	f0	101e	ac920af293100678
                    VLXPDC03	f0	101f	ac920af29310067c
                    VLXPDC03	f0	1020	ac920af293100680
                    VLXPDC03	f0	1021	ac920af293100684
                    VLXPDC03	f0	1022	ac920af293100688
                    VLXPDC03	f0	1023	ac920af29310068c
                    VLXPDC03	f0	1024	ac920af293100690
                    VLXPDC03	f0	1025	ac920af293100694
                    VLXPDC03	f0	1026	ac920af293100698
                    VLXPDC03	f0	1027	ac920af29310069c
                    VLXPDC03	f0	1028	ac920af2931006a0
                    VLXPDC03	f0	1029	ac920af2931006a4
                    VLXPDC03	f0	102a	ac920af2931006a8
                    VLXPDC03	f0	102b	ac920af2931006ac
                    VLXPDC03	f0	102c	ac920af2931006b0
                    VLXPDC03	f0	102d	ac920af2931006b4
                    VLXPDC03	f0	102e	ac920af2931006b8
                    VLXPDC03	f0	102f	ac920af2931006bc
                    VLXPDC03	f0	1030	ac920af2931006c0
                    VLXPDC03	f0	1031	ac920af2931006c4
                    VLXPDC03	f0	1032	ac920af2931006c8
                    VLXPDC03	f0	1033	ac920af2931006cc
                    VLXPDC03	f0	1034	ac920af2931006d0
                    VLXPDC03	f0	1035	ac920af2931006d4
                    VLXPDC03	f0	1036	ac920af2931006d8
                    VLXPDC03	f0	1037	ac920af2931006dc
                    VLXPDC03	f0	1038	ac920af2931006e0
                    VLXPDC03	f0	1039	ac920af2931006e4
                    VLXPDC03	f0	103a	ac920af2931006e8
                    VLXPDC03	f0	103b	ac920af2931006ec
                    VLXPDC03	f0	103c	ac920af2931006f0
                    VLXPDC03	f0	103d	ac920af2931006f4
                    VLXPDC03	f0	103e	ac920af2931006f8
                    VLXPDC03	f0	103f	ac920af2931006fc
                    DC30FCP_VLXPDC03_F4_E123L_E123K_E123X_2000_203F			
                    VLXPDC03	f4	2000	ac920af293101800
                    VLXPDC03	f4	2001	ac920af293101804
                    VLXPDC03	f4	2002	ac920af293101808
                    VLXPDC03	f4	2003	ac920af29310180c
                    VLXPDC03	f4	2004	ac920af293101810
                    VLXPDC03	f4	2005	ac920af293101814
                    VLXPDC03	f4	2006	ac920af293101818
                    VLXPDC03	f4	2007	ac920af29310181c
                    VLXPDC03	f4	2008	ac920af293101820
                    VLXPDC03	f4	2009	ac920af293101824
                    VLXPDC03	f4	200a	ac920af293101828
                    VLXPDC03	f4	200b	ac920af29310182c
                    VLXPDC03	f4	200c	ac920af293101830
                    VLXPDC03	f4	200d	ac920af293101834
                    VLXPDC03	f4	200e	ac920af293101838
                    VLXPDC03	f4	200f	ac920af29310183c
                    VLXPDC03	f4	2010	ac920af293101840
                    VLXPDC03	f4	2011	ac920af293101844
                    VLXPDC03	f4	2012	ac920af293101848
                    VLXPDC03	f4	2013	ac920af29310184c
                    VLXPDC03	f4	2014	ac920af293101850
                    VLXPDC03	f4	2015	ac920af293101854
                    VLXPDC03	f4	2016	ac920af293101858
                    VLXPDC03	f4	2017	ac920af29310185c
                    VLXPDC03	f4	2018	ac920af293101860
                    VLXPDC03	f4	2019	ac920af293101864
                    VLXPDC03	f4	201a	ac920af293101868
                    VLXPDC03	f4	201b	ac920af29310186c
                    VLXPDC03	f4	201c	ac920af293101870
                    VLXPDC03	f4	201d	ac920af293101874
                    VLXPDC03	f4	201e	ac920af293101878
                    VLXPDC03	f4	201f	ac920af29310187c
                    VLXPDC03	f4	2020	ac920af293101880
                    VLXPDC03	f4	2021	ac920af293101884
                    VLXPDC03	f4	2022	ac920af293101888
                    VLXPDC03	f4	2023	ac920af29310188c
                    VLXPDC03	f4	2024	ac920af293101890
                    VLXPDC03	f4	2025	ac920af293101894
                    VLXPDC03	f4	2026	ac920af293101898
                    VLXPDC03	f4	2027	ac920af29310189c
                    VLXPDC03	f4	2028	ac920af2931018a0
                    VLXPDC03	f4	2029	ac920af2931018a4
                    VLXPDC03	f4	202a	ac920af2931018a8
                    VLXPDC03	f4	202b	ac920af2931018ac
                    VLXPDC03	f4	202c	ac920af2931018b0
                    VLXPDC03	f4	202d	ac920af2931018b4
                    VLXPDC03	f4	202e	ac920af2931018b8
                    VLXPDC03	f4	202f	ac920af2931018bc
                    VLXPDC03	f4	2030	ac920af2931018c0
                    VLXPDC03	f4	2031	ac920af2931018c4
                    VLXPDC03	f4	2032	ac920af2931018c8
                    VLXPDC03	f4	2033	ac920af2931018cc
                    VLXPDC03	f4	2034	ac920af2931018d0
                    VLXPDC03	f4	2035	ac920af2931018d4
                    VLXPDC03	f4	2036	ac920af2931018d8
                    VLXPDC03	f4	2037	ac920af2931018dc
                    VLXPDC03	f4	2038	ac920af2931018e0
                    VLXPDC03	f4	2039	ac920af2931018e4
                    VLXPDC03	f4	203a	ac920af2931018e8
                    VLXPDC03	f4	203b	ac920af2931018ec
                    VLXPDC03	f4	203c	ac920af2931018f0
                    VLXPDC03	f4	203d	ac920af2931018f4
                    VLXPDC03	f4	203e	ac920af2931018f8
                    VLXPDC03	f4	203f	ac920af2931018fc
                    

                    This is sourced from an Excel table where the “header” is a formula that grabs several data points to create a unique name based on criteria I attempted to explain in my original post.

                    Because that “header”, which for my specific use case is a Zone Name, is followed by a series of 3 tabs, my first step is to remove those:

                    Search: \h+$ #Using greedy search as the only place my source has tabs at the end of the line is with my Zone Name
                    Replace: <nothing>

                    (Turns out complete process exceeds post size, part 1 of ??)

                    Brian Crosby 0B 1 Reply Last reply Reply Quote 1
                    • Brian Crosby 0B
                      Brian Crosby 0 @Brian Crosby 0
                      last edited by

                      @Brian-Crosby-0
                      Part 2 of ???

                      For the specific command syntax I am trying to get to eventually I do not need the first 3 colums in the rest of the data:

                      Search: ^\w.+\t #Again using greedy because I want to capture through the last tab prior to the WWPN which consists of 16 consecutive HEX digits
                      Replace: <nothing> #just discarding that data for the script

                      This gives me a table that looks like this:

                      DC30FCP_VLXPDC03_F0_E123L_E123K_E123X_1000_103F
                      ac920af293100600
                      ac920af293100604
                      ac920af293100608
                      ac920af29310060c
                      ac920af293100610
                      ac920af293100614
                      ac920af293100618
                      ac920af29310061c
                      ac920af293100620
                      ac920af293100624
                      ac920af293100628
                      ac920af29310062c
                      ac920af293100630
                      ac920af293100634
                      ac920af293100638
                      ac920af29310063c
                      ac920af293100640
                      ac920af293100644
                      ac920af293100648
                      ac920af29310064c
                      ac920af293100650
                      ac920af293100654
                      ac920af293100658
                      ac920af29310065c
                      ac920af293100660
                      ac920af293100664
                      ac920af293100668
                      ac920af29310066c
                      ac920af293100670
                      ac920af293100674
                      ac920af293100678
                      ac920af29310067c
                      ac920af293100680
                      ac920af293100684
                      ac920af293100688
                      ac920af29310068c
                      ac920af293100690
                      ac920af293100694
                      ac920af293100698
                      ac920af29310069c
                      ac920af2931006a0
                      ac920af2931006a4
                      ac920af2931006a8
                      ac920af2931006ac
                      ac920af2931006b0
                      ac920af2931006b4
                      ac920af2931006b8
                      ac920af2931006bc
                      ac920af2931006c0
                      ac920af2931006c4
                      ac920af2931006c8
                      ac920af2931006cc
                      ac920af2931006d0
                      ac920af2931006d4
                      ac920af2931006d8
                      ac920af2931006dc
                      ac920af2931006e0
                      ac920af2931006e4
                      ac920af2931006e8
                      ac920af2931006ec
                      ac920af2931006f0
                      ac920af2931006f4
                      ac920af2931006f8
                      ac920af2931006fc
                      DC30FCP_VLXPDC03_F4_E123L_E123K_E123X_2000_203F
                      ac920af293101800
                      ac920af293101804
                      ac920af293101808
                      ac920af29310180c
                      ac920af293101810
                      ac920af293101814
                      ac920af293101818
                      ac920af29310181c
                      ac920af293101820
                      ac920af293101824
                      ac920af293101828
                      ac920af29310182c
                      ac920af293101830
                      ac920af293101834
                      ac920af293101838
                      ac920af29310183c
                      ac920af293101840
                      ac920af293101844
                      ac920af293101848
                      ac920af29310184c
                      ac920af293101850
                      ac920af293101854
                      ac920af293101858
                      ac920af29310185c
                      ac920af293101860
                      ac920af293101864
                      ac920af293101868
                      ac920af29310186c
                      ac920af293101870
                      ac920af293101874
                      ac920af293101878
                      ac920af29310187c
                      ac920af293101880
                      ac920af293101884
                      ac920af293101888
                      ac920af29310188c
                      ac920af293101890
                      ac920af293101894
                      ac920af293101898
                      ac920af29310189c
                      ac920af2931018a0
                      ac920af2931018a4
                      ac920af2931018a8
                      ac920af2931018ac
                      ac920af2931018b0
                      ac920af2931018b4
                      ac920af2931018b8
                      ac920af2931018bc
                      ac920af2931018c0
                      ac920af2931018c4
                      ac920af2931018c8
                      ac920af2931018cc
                      ac920af2931018d0
                      ac920af2931018d4
                      ac920af2931018d8
                      ac920af2931018dc
                      ac920af2931018e0
                      ac920af2931018e4
                      ac920af2931018e8
                      ac920af2931018ec
                      ac920af2931018f0
                      ac920af2931018f4
                      ac920af2931018f8
                      ac920af2931018fc
                      

                      (Note - used the triple backtick notation on both data sets and the preview is showing something different…)

                      The next two operations will provide a little space between Zone Name and prior set of WWPN data and provide the first concatentated strings (for the command syntax I need).
                      I am certain that there is probably a more concise syntax for this, but I’m relatively new to REGEX and it works for my use case:

                      Find: ^(\w{2}[0-9a-f]{2}FCP\w+)$ #Finds the Zone Name on a line by itself
                      Replace: \r\n@$1 #prepends it with a blank line and a @ to grab hold of later
                      Find: ([0-9a-f]{16})\R([0-9a-f]{16})\R([0-9a-f]{16})\R([0-9a-f]{16})\R([0-9a-f]{16})\R([0-9a-f]{16})\R([0-9a-f]{16})\R([0-9a-f]{16})\R #Sets up groups of 8 WWPN for the command script I need
                      Replace: ~$1;$2;$3;$4;$5;$6;$7;$8" #Adds the “;” delimiter between values and closes the command with a double quote plus the ~ to reference each grouping by in next steps

                      My data now looks like this:

                      @DC30FCP_VLXPDC03_F0_E123L_E123K_E123X_1000_103F
                      ~ac920af293100600;ac920af293100604;ac920af293100608;ac920af29310060c;ac920af293100610;ac920af293100614;ac920af293100618;ac920af29310061c"~ac920af293100620;ac920af293100624;ac920af293100628;ac920af29310062c;ac920af293100630;ac920af293100634;ac920af293100638;ac920af29310063c"~ac920af293100640;ac920af293100644;ac920af293100648;ac920af29310064c;ac920af293100650;ac920af293100654;ac920af293100658;ac920af29310065c"~ac920af293100660;ac920af293100664;ac920af293100668;ac920af29310066c;ac920af293100670;ac920af293100674;ac920af293100678;ac920af29310067c"~ac920af293100680;ac920af293100684;ac920af293100688;ac920af29310068c;ac920af293100690;ac920af293100694;ac920af293100698;ac920af29310069c"~ac920af2931006a0;ac920af2931006a4;ac920af2931006a8;ac920af2931006ac;ac920af2931006b0;ac920af2931006b4;ac920af2931006b8;ac920af2931006bc"~ac920af2931006c0;ac920af2931006c4;ac920af2931006c8;ac920af2931006cc;ac920af2931006d0;ac920af2931006d4;ac920af2931006d8;ac920af2931006dc"~ac920af2931006e0;ac920af2931006e4;ac920af2931006e8;ac920af2931006ec;ac920af2931006f0;ac920af2931006f4;ac920af2931006f8;ac920af2931006fc"
                      @DC30FCP_VLXPDC03_F4_E123L_E123K_E123X_2000_203F
                      ~ac920af293101800;ac920af293101804;ac920af293101808;ac920af29310180c;ac920af293101810;ac920af293101814;ac920af293101818;ac920af29310181c"~ac920af293101820;ac920af293101824;ac920af293101828;ac920af29310182c;ac920af293101830;ac920af293101834;ac920af293101838;ac920af29310183c"~ac920af293101840;ac920af293101844;ac920af293101848;ac920af29310184c;ac920af293101850;ac920af293101854;ac920af293101858;ac920af29310185c"~ac920af293101860;ac920af293101864;ac920af293101868;ac920af29310186c;ac920af293101870;ac920af293101874;ac920af293101878;ac920af29310187c"~ac920af293101880;ac920af293101884;ac920af293101888;ac920af29310188c;ac920af293101890;ac920af293101894;ac920af293101898;ac920af29310189c"~ac920af2931018a0;ac920af2931018a4;ac920af2931018a8;ac920af2931018ac;ac920af2931018b0;ac920af2931018b4;ac920af2931018b8;ac920af2931018bc"~ac920af2931018c0;ac920af2931018c4;ac920af2931018c8;ac920af2931018cc;ac920af2931018d0;ac920af2931018d4;ac920af2931018d8;ac920af2931018dc"~ac920af2931018e0;ac920af2931018e4;ac920af2931018e8;ac920af2931018ec;ac920af2931018f0;ac920af2931018f4;ac920af2931018f8;ac920af2931018fc"
                      

                      (again my preview using the triple backticks is off, apparently because my data includes double quotes, we’ll just have to see if this looks right after all said and done)

                      Part 2 of ??

                      1 Reply Last reply Reply Quote 0
                      • Brian Crosby 0B
                        Brian Crosby 0
                        last edited by

                        Maybe 3 of 3 (getting flagged as spam for being thorough)

                        @Brian-Crosby-0

                        Part 3 of ?? (This should be the last one)

                        Now to move the Zone Name to the end of the lines of data in prep for the lookahead functions:

                        Find: (@\w{2}[0-9a-f]{2}FCP\w+)\R(~[0-9a-f]{16}[;"].*)
                        Replace: $2$1

                        Which gives me this:

                        ~ac920af293100600;ac920af293100604;ac920af293100608;ac920af29310060c;ac920af293100610;ac920af293100614;ac920af293100618;ac920af29310061c"~ac920af293100620;ac920af293100624;ac920af293100628;ac920af29310062c;ac920af293100630;ac920af293100634;ac920af293100638;ac920af29310063c"~ac920af293100640;ac920af293100644;ac920af293100648;ac920af29310064c;ac920af293100650;ac920af293100654;ac920af293100658;ac920af29310065c"~ac920af293100660;ac920af293100664;ac920af293100668;ac920af29310066c;ac920af293100670;ac920af293100674;ac920af293100678;ac920af29310067c"~ac920af293100680;ac920af293100684;ac920af293100688;ac920af29310068c;ac920af293100690;ac920af293100694;ac920af293100698;ac920af29310069c"~ac920af2931006a0;ac920af2931006a4;ac920af2931006a8;ac920af2931006ac;ac920af2931006b0;ac920af2931006b4;ac920af2931006b8;ac920af2931006bc"~ac920af2931006c0;ac920af2931006c4;ac920af2931006c8;ac920af2931006cc;ac920af2931006d0;ac920af2931006d4;ac920af2931006d8;ac920af2931006dc"~ac920af2931006e0;ac920af2931006e4;ac920af2931006e8;ac920af2931006ec;ac920af2931006f0;ac920af2931006f4;ac920af2931006f8;ac920af2931006fc"@DC30FCP_VLXPDC03_F0_E123L_E123K_E123X_1000_103F
                        ~ac920af293101800;ac920af293101804;ac920af293101808;ac920af29310180c;ac920af293101810;ac920af293101814;ac920af293101818;ac920af29310181c"~ac920af293101820;ac920af293101824;ac920af293101828;ac920af29310182c;ac920af293101830;ac920af293101834;ac920af293101838;ac920af29310183c"~ac920af293101840;ac920af293101844;ac920af293101848;ac920af29310184c;ac920af293101850;ac920af293101854;ac920af293101858;ac920af29310185c"~ac920af293101860;ac920af293101864;ac920af293101868;ac920af29310186c;ac920af293101870;ac920af293101874;ac920af293101878;ac920af29310187c"~ac920af293101880;ac920af293101884;ac920af293101888;ac920af29310188c;ac920af293101890;ac920af293101894;ac920af293101898;ac920af29310189c"~ac920af2931018a0;ac920af2931018a4;ac920af2931018a8;ac920af2931018ac;ac920af2931018b0;ac920af2931018b4;ac920af2931018b8;ac920af2931018bc"~ac920af2931018c0;ac920af2931018c4;ac920af2931018c8;ac920af2931018cc;ac920af2931018d0;ac920af2931018d4;ac920af2931018d8;ac920af2931018dc"~ac920af2931018e0;ac920af2931018e4;ac920af2931018e8;ac920af2931018ec;ac920af2931018f0;ac920af2931018f4;ac920af2931018f8;ac920af2931018fc"@DC30FCP_VLXPDC03_F4_E123L_E123K_E123X_2000_203F
                        

                        Finally using the lookahead syntax @PeterJones provided, AND I found I could combine a step here:

                        Find: (?<=~)(?=.*@(.*$))
                        Replace: \r\nzoneadd --peerzone "$1" -member "

                        As Peter provided, this defines the region for seach and gives bounds using the ~ and @ characters to key from, and I was finally able to complete the actual command syntax for the operation I am prepping the data for. Data now looks like:

                        ~
                        zoneadd --peerzone "DC30FCP_VLXPDC03_F0_E123L_E123K_E123X_1000_103F" -member "ac920af293100600;ac920af293100604;ac920af293100608;ac920af29310060c;ac920af293100610;ac920af293100614;ac920af293100618;ac920af29310061c"~
                        zoneadd --peerzone "DC30FCP_VLXPDC03_F0_E123L_E123K_E123X_1000_103F" -member "ac920af293100620;ac920af293100624;ac920af293100628;ac920af29310062c;ac920af293100630;ac920af293100634;ac920af293100638;ac920af29310063c"~
                        zoneadd --peerzone "DC30FCP_VLXPDC03_F0_E123L_E123K_E123X_1000_103F" -member "ac920af293100640;ac920af293100644;ac920af293100648;ac920af29310064c;ac920af293100650;ac920af293100654;ac920af293100658;ac920af29310065c"~
                        zoneadd --peerzone "DC30FCP_VLXPDC03_F0_E123L_E123K_E123X_1000_103F" -member "ac920af293100660;ac920af293100664;ac920af293100668;ac920af29310066c;ac920af293100670;ac920af293100674;ac920af293100678;ac920af29310067c"~
                        zoneadd --peerzone "DC30FCP_VLXPDC03_F0_E123L_E123K_E123X_1000_103F" -member "ac920af293100680;ac920af293100684;ac920af293100688;ac920af29310068c;ac920af293100690;ac920af293100694;ac920af293100698;ac920af29310069c"~
                        zoneadd --peerzone "DC30FCP_VLXPDC03_F0_E123L_E123K_E123X_1000_103F" -member "ac920af2931006a0;ac920af2931006a4;ac920af2931006a8;ac920af2931006ac;ac920af2931006b0;ac920af2931006b4;ac920af2931006b8;ac920af2931006bc"~
                        zoneadd --peerzone "DC30FCP_VLXPDC03_F0_E123L_E123K_E123X_1000_103F" -member "ac920af2931006c0;ac920af2931006c4;ac920af2931006c8;ac920af2931006cc;ac920af2931006d0;ac920af2931006d4;ac920af2931006d8;ac920af2931006dc"~
                        zoneadd --peerzone "DC30FCP_VLXPDC03_F0_E123L_E123K_E123X_1000_103F" -member "ac920af2931006e0;ac920af2931006e4;ac920af2931006e8;ac920af2931006ec;ac920af2931006f0;ac920af2931006f4;ac920af2931006f8;ac920af2931006fc"@DC30FCP_VLXPDC03_F0_E123L_E123K_E123X_1000_103F
                        ~
                        zoneadd --peerzone "DC30FCP_VLXPDC03_F4_E123L_E123K_E123X_2000_203F" -member "ac920af293101800;ac920af293101804;ac920af293101808;ac920af29310180c;ac920af293101810;ac920af293101814;ac920af293101818;ac920af29310181c"~
                        zoneadd --peerzone "DC30FCP_VLXPDC03_F4_E123L_E123K_E123X_2000_203F" -member "ac920af293101820;ac920af293101824;ac920af293101828;ac920af29310182c;ac920af293101830;ac920af293101834;ac920af293101838;ac920af29310183c"~
                        zoneadd --peerzone "DC30FCP_VLXPDC03_F4_E123L_E123K_E123X_2000_203F" -member "ac920af293101840;ac920af293101844;ac920af293101848;ac920af29310184c;ac920af293101850;ac920af293101854;ac920af293101858;ac920af29310185c"~
                        zoneadd --peerzone "DC30FCP_VLXPDC03_F4_E123L_E123K_E123X_2000_203F" -member "ac920af293101860;ac920af293101864;ac920af293101868;ac920af29310186c;ac920af293101870;ac920af293101874;ac920af293101878;ac920af29310187c"~
                        zoneadd --peerzone "DC30FCP_VLXPDC03_F4_E123L_E123K_E123X_2000_203F" -member "ac920af293101880;ac920af293101884;ac920af293101888;ac920af29310188c;ac920af293101890;ac920af293101894;ac920af293101898;ac920af29310189c"~
                        zoneadd --peerzone "DC30FCP_VLXPDC03_F4_E123L_E123K_E123X_2000_203F" -member "ac920af2931018a0;ac920af2931018a4;ac920af2931018a8;ac920af2931018ac;ac920af2931018b0;ac920af2931018b4;ac920af2931018b8;ac920af2931018bc"~
                        zoneadd --peerzone "DC30FCP_VLXPDC03_F4_E123L_E123K_E123X_2000_203F" -member "ac920af2931018c0;ac920af2931018c4;ac920af2931018c8;ac920af2931018cc;ac920af2931018d0;ac920af2931018d4;ac920af2931018d8;ac920af2931018dc"~
                        zoneadd --peerzone "DC30FCP_VLXPDC03_F4_E123L_E123K_E123X_2000_203F" -member "ac920af2931018e0;ac920af2931018e4;ac920af2931018e8;ac920af2931018ec;ac920af2931018f0;ac920af2931018f4;ac920af2931018f8;ac920af2931018fc"@DC30FCP_VLXPDC03_F4_E123L_E123K_E123X_2000_203F
                        

                        A little cleanup for the marker text and “extra” Zone Name references:

                        Find: (~|\t@.*$)
                        Replace: <leave blank>

                        And add in the WWPN delimiters needed for the SAN switches I manage:

                        Find: ([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})
                        Replace: $1:$2:$3:$4:$5:$6:$7:$8

                        With that we have the end product:

                        zoneadd --peerzone "DC30FCP_VLXPDC03_F0_E123L_E123K_E123X_1000_103F" -member "ac:92:0a:f2:93:10:06:00;ac:92:0a:f2:93:10:06:04;ac:92:0a:f2:93:10:06:08;ac:92:0a:f2:93:10:06:0c;ac:92:0a:f2:93:10:06:10;ac:92:0a:f2:93:10:06:14;ac:92:0a:f2:93:10:06:18;ac:92:0a:f2:93:10:06:1c"
                        zoneadd --peerzone "DC30FCP_VLXPDC03_F0_E123L_E123K_E123X_1000_103F" -member "ac:92:0a:f2:93:10:06:20;ac:92:0a:f2:93:10:06:24;ac:92:0a:f2:93:10:06:28;ac:92:0a:f2:93:10:06:2c;ac:92:0a:f2:93:10:06:30;ac:92:0a:f2:93:10:06:34;ac:92:0a:f2:93:10:06:38;ac:92:0a:f2:93:10:06:3c"
                        zoneadd --peerzone "DC30FCP_VLXPDC03_F0_E123L_E123K_E123X_1000_103F" -member "ac:92:0a:f2:93:10:06:40;ac:92:0a:f2:93:10:06:44;ac:92:0a:f2:93:10:06:48;ac:92:0a:f2:93:10:06:4c;ac:92:0a:f2:93:10:06:50;ac:92:0a:f2:93:10:06:54;ac:92:0a:f2:93:10:06:58;ac:92:0a:f2:93:10:06:5c"
                        zoneadd --peerzone "DC30FCP_VLXPDC03_F0_E123L_E123K_E123X_1000_103F" -member "ac:92:0a:f2:93:10:06:60;ac:92:0a:f2:93:10:06:64;ac:92:0a:f2:93:10:06:68;ac:92:0a:f2:93:10:06:6c;ac:92:0a:f2:93:10:06:70;ac:92:0a:f2:93:10:06:74;ac:92:0a:f2:93:10:06:78;ac:92:0a:f2:93:10:06:7c"
                        zoneadd --peerzone "DC30FCP_VLXPDC03_F0_E123L_E123K_E123X_1000_103F" -member "ac:92:0a:f2:93:10:06:80;ac:92:0a:f2:93:10:06:84;ac:92:0a:f2:93:10:06:88;ac:92:0a:f2:93:10:06:8c;ac:92:0a:f2:93:10:06:90;ac:92:0a:f2:93:10:06:94;ac:92:0a:f2:93:10:06:98;ac:92:0a:f2:93:10:06:9c"
                        zoneadd --peerzone "DC30FCP_VLXPDC03_F0_E123L_E123K_E123X_1000_103F" -member "ac:92:0a:f2:93:10:06:a0;ac:92:0a:f2:93:10:06:a4;ac:92:0a:f2:93:10:06:a8;ac:92:0a:f2:93:10:06:ac;ac:92:0a:f2:93:10:06:b0;ac:92:0a:f2:93:10:06:b4;ac:92:0a:f2:93:10:06:b8;ac:92:0a:f2:93:10:06:bc"
                        zoneadd --peerzone "DC30FCP_VLXPDC03_F0_E123L_E123K_E123X_1000_103F" -member "ac:92:0a:f2:93:10:06:c0;ac:92:0a:f2:93:10:06:c4;ac:92:0a:f2:93:10:06:c8;ac:92:0a:f2:93:10:06:cc;ac:92:0a:f2:93:10:06:d0;ac:92:0a:f2:93:10:06:d4;ac:92:0a:f2:93:10:06:d8;ac:92:0a:f2:93:10:06:dc"
                        zoneadd --peerzone "DC30FCP_VLXPDC03_F0_E123L_E123K_E123X_1000_103F" -member "ac:92:0a:f2:93:10:06:e0;ac:92:0a:f2:93:10:06:e4;ac:92:0a:f2:93:10:06:e8;ac:92:0a:f2:93:10:06:ec;ac:92:0a:f2:93:10:06:f0;ac:92:0a:f2:93:10:06:f4;ac:92:0a:f2:93:10:06:f8;ac:92:0a:f2:93:10:06:fc"@DC30FCP_VLXPDC03_F0_E123L_E123K_E123X_1000_103F
                        
                        zoneadd --peerzone "DC30FCP_VLXPDC03_F4_E123L_E123K_E123X_2000_203F" -member "ac:92:0a:f2:93:10:18:00;ac:92:0a:f2:93:10:18:04;ac:92:0a:f2:93:10:18:08;ac:92:0a:f2:93:10:18:0c;ac:92:0a:f2:93:10:18:10;ac:92:0a:f2:93:10:18:14;ac:92:0a:f2:93:10:18:18;ac:92:0a:f2:93:10:18:1c"
                        zoneadd --peerzone "DC30FCP_VLXPDC03_F4_E123L_E123K_E123X_2000_203F" -member "ac:92:0a:f2:93:10:18:20;ac:92:0a:f2:93:10:18:24;ac:92:0a:f2:93:10:18:28;ac:92:0a:f2:93:10:18:2c;ac:92:0a:f2:93:10:18:30;ac:92:0a:f2:93:10:18:34;ac:92:0a:f2:93:10:18:38;ac:92:0a:f2:93:10:18:3c"
                        zoneadd --peerzone "DC30FCP_VLXPDC03_F4_E123L_E123K_E123X_2000_203F" -member "ac:92:0a:f2:93:10:18:40;ac:92:0a:f2:93:10:18:44;ac:92:0a:f2:93:10:18:48;ac:92:0a:f2:93:10:18:4c;ac:92:0a:f2:93:10:18:50;ac:92:0a:f2:93:10:18:54;ac:92:0a:f2:93:10:18:58;ac:92:0a:f2:93:10:18:5c"
                        zoneadd --peerzone "DC30FCP_VLXPDC03_F4_E123L_E123K_E123X_2000_203F" -member "ac:92:0a:f2:93:10:18:60;ac:92:0a:f2:93:10:18:64;ac:92:0a:f2:93:10:18:68;ac:92:0a:f2:93:10:18:6c;ac:92:0a:f2:93:10:18:70;ac:92:0a:f2:93:10:18:74;ac:92:0a:f2:93:10:18:78;ac:92:0a:f2:93:10:18:7c"
                        zoneadd --peerzone "DC30FCP_VLXPDC03_F4_E123L_E123K_E123X_2000_203F" -member "ac:92:0a:f2:93:10:18:80;ac:92:0a:f2:93:10:18:84;ac:92:0a:f2:93:10:18:88;ac:92:0a:f2:93:10:18:8c;ac:92:0a:f2:93:10:18:90;ac:92:0a:f2:93:10:18:94;ac:92:0a:f2:93:10:18:98;ac:92:0a:f2:93:10:18:9c"
                        zoneadd --peerzone "DC30FCP_VLXPDC03_F4_E123L_E123K_E123X_2000_203F" -member "ac:92:0a:f2:93:10:18:a0;ac:92:0a:f2:93:10:18:a4;ac:92:0a:f2:93:10:18:a8;ac:92:0a:f2:93:10:18:ac;ac:92:0a:f2:93:10:18:b0;ac:92:0a:f2:93:10:18:b4;ac:92:0a:f2:93:10:18:b8;ac:92:0a:f2:93:10:18:bc"
                        zoneadd --peerzone "DC30FCP_VLXPDC03_F4_E123L_E123K_E123X_2000_203F" -member "ac:92:0a:f2:93:10:18:c0;ac:92:0a:f2:93:10:18:c4;ac:92:0a:f2:93:10:18:c8;ac:92:0a:f2:93:10:18:cc;ac:92:0a:f2:93:10:18:d0;ac:92:0a:f2:93:10:18:d4;ac:92:0a:f2:93:10:18:d8;ac:92:0a:f2:93:10:18:dc"
                        zoneadd --peerzone "DC30FCP_VLXPDC03_F4_E123L_E123K_E123X_2000_203F" -member "ac:92:0a:f2:93:10:18:e0;ac:92:0a:f2:93:10:18:e4;ac:92:0a:f2:93:10:18:e8;ac:92:0a:f2:93:10:18:ec;ac:92:0a:f2:93:10:18:f0;ac:92:0a:f2:93:10:18:f4;ac:92:0a:f2:93:10:18:f8;ac:92:0a:f2:93:10:18:fc"@DC30FCP_VLXPDC03_F4_E123L_E123K_E123X_2000_203F
                        

                        So - again, I would like to thank everyone for their input. I’m continuing to try and understand the syntax with the lookahead and such. Now to go back and re-record my macro with all steps and I’ll turn a process that originally could take a person all day, or even several days into a single key combination process.

                        PeterJonesP 1 Reply Last reply Reply Quote 1
                        • PeterJonesP
                          PeterJones @Brian Crosby 0
                          last edited by

                          @Brian-Crosby-0 ,

                          Congratulations on taking our suggestions and getting them customized to work with your actual data.

                          I know it’s sometimes painful to have us keep tell you “you’re doing it wrong”. But in the end, I hope our process was able to teach you some more about regex, where to find Notepad++-specific regex info, and about how to ask technical questions (here and elsewhere) in a way that gets better answers more quickly.

                          Brian Crosby 0B 1 Reply Last reply Reply Quote 1
                          • Brian Crosby 0B
                            Brian Crosby 0 @PeterJones
                            last edited by

                            @PeterJones

                            Yeah, I finally was able to take some time and use the markup tutorial. The </> button was adding extra triple tick marks, then giving the “hint” that its for code; I don’t consider data code…

                            Not sure who’s comment mentioned my use of REGEX101, but mostly I am using it as a way to break down the components of the REGEX to understand what each piece is doing. Something I tried to do also with my explanation of what I “think” each of my expressions was doing.

                            Having someone offer a potential solution is awesome and I appreciate anyone that takes the time to help people, but often there is very little of the “why/what” breakdown that leaves me still scratching my head. Your breakdown on what was going where and why is what provided my mental breakthrough to grasp what was being offered.

                            1 Reply Last reply Reply Quote 0
                            • Terry RT Terry R referenced this topic on
                            • First post
                              Last post
                            The Community of users of the Notepad++ text editor.
                            Powered by NodeBB | Contributors