• Login
Community
  • Login

Creating Line Break when there are multiple spaces on tagged line.

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
17 Posts 3 Posters 1.2k 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.
  • A
    Alan Kilborn @Ashley Hoogenboom
    last edited by Alan Kilborn Feb 15, 2022, 9:55 PM Feb 15, 2022, 9:54 PM

    @ashley-hoogenboom said in Creating Line Break when there are multiple spaces on tagged line.:

    [C2:WT2400P   Wire Transfer Notices]
    

    Ah ha! Another definition of “3 spaces”! :-)

    @ashley-hoogenboom said in Creating Line Break when there are multiple spaces on tagged line.:

    But really want to learn!

    We like people like that! :-)

    A 1 Reply Last reply Feb 15, 2022, 9:56 PM Reply Quote 1
    • A
      Ashley Hoogenboom @Alan Kilborn
      last edited by Feb 15, 2022, 9:56 PM

      @alan-kilborn said in Creating Line Break when there are multiple spaces on tagged line.:

      Ah ha! Another definition of “3 spaces”! :-)

      Yes, sorry the first time when I copied it over it didn’t keep the additional spacing.

      A L 2 Replies Last reply Feb 15, 2022, 10:02 PM Reply Quote 0
      • A
        Alan Kilborn @Ashley Hoogenboom
        last edited by Alan Kilborn Feb 15, 2022, 10:04 PM Feb 15, 2022, 10:02 PM

        @ashley-hoogenboom

        Try:

        find: (?-s)^((\\[C2:)\w+)\x20{3}(.+)\\](\R)
        repl: ${1}]${4}${2}${3}]${4}
        search mode: regular expression

        A 1 Reply Last reply Feb 15, 2022, 10:11 PM Reply Quote 3
        • L
          Lycan Thrope @Ashley Hoogenboom
          last edited by Feb 15, 2022, 10:04 PM

          @ashley-hoogenboom ,

          Then you need to better prepare your example texts so someone doesn’t ignore you in exhaustion. Like you, I didn’t know crap about this Regex stuff until I needed to learn here with these good people’s help, but I always gave them exactly what I was using, what I needed and how it should look. This of course, is after I had beat my head silly trying to learn this on my own, so I at least had an inkling of what they were telling me in response…even if I didn’t understand what it was. I suggest you do the same. Learn what you can, then ask questions as you go, but changing the goal posts of what you want from the same piece of text is on you.

          Honestly, I’ve been following this forum in the background and now I understand the frustration these folks have gotten to, trying to help people that don’t have an inkling of what it is they really want and expect people to read their intentions, rather than their needs.

          Lee

          A 1 Reply Last reply Feb 15, 2022, 10:06 PM Reply Quote 2
          • L
            Lycan Thrope @Ashley Hoogenboom
            last edited by Feb 15, 2022, 10:05 PM

            @ashley-hoogenboom
            C2_S_RScreenshot.PNG

            1 Reply Last reply Reply Quote 0
            • A
              Alan Kilborn @Lycan Thrope
              last edited by Feb 15, 2022, 10:06 PM

              @lycan-thrope said in Creating Line Break when there are multiple spaces on tagged line.:

              Then you need to better prepare your example texts

              A bit harsh. You don’t know what you aren’t doing right until someone tells you, most times…

              The OP seemed very agreeable to read the info I pointed to, and rework the question/data to conform.

              L 1 Reply Last reply Feb 15, 2022, 10:09 PM Reply Quote 0
              • L
                Lycan Thrope @Alan Kilborn
                last edited by Lycan Thrope Feb 15, 2022, 10:10 PM Feb 15, 2022, 10:09 PM

                @alan-kilborn ,

                Perhaps, but I was the recipient of like until I got the system right, too. Mostly my problems stemmed from trying to describe the problem without knowing what the forum’s formatting norms were. It was my bad…and I was called on carpet about it, too, appropriately. :)

                Interestingly, my solution should have worked for him, anyway, spaces or not.::shrug::

                Lee

                A 1 Reply Last reply Feb 15, 2022, 10:16 PM Reply Quote 0
                • A
                  Ashley Hoogenboom @Alan Kilborn
                  last edited by Feb 15, 2022, 10:11 PM

                  @alan-kilborn said in Creating Line Break when there are multiple spaces on tagged line.:

                  (?-s)^(([C2:)\w+)\x20{3}(.+)](\R)

                  Thank you! That worked! If you have time can you explain that to me. If not I will be looking it up to make sense of it all.

                  A 1 Reply Last reply Feb 15, 2022, 10:13 PM Reply Quote 1
                  • A
                    Alan Kilborn @Ashley Hoogenboom
                    last edited by Feb 15, 2022, 10:13 PM

                    @ashley-hoogenboom said in Creating Line Break when there are multiple spaces on tagged line.:

                    If you have time can you explain that to me

                    (?-s)^(([C2:)\w+)\x20{3}(.+)](\R)

                    (?-s)^((\[C2:)\w+)\x20{3}(.+)\](\R)
                    
                    • Use these options for the whole regular expression (?-s)
                      • (hyphen inverts the meaning of the letters that follow) -
                      • Dot doesn’t match line breaks s
                    • Assert position at the beginning of a line (at beginning of the string or after a line break character) (carriage return and line feed, form feed, next line, line separator, paragraph separator) ^
                    • Match the regex below and capture its match into backreference number 1 ((\[C2:)\w+)
                      • Match the regex below and capture its match into backreference number 2 (\[C2:)
                        • [Match the character “” literally \[
                        • Match the character string “C2:” literally (case sensitive) C2:
                      • Match a single character that is a “word character” (Unicode; any letter or ideograph, digit, letter number, underscore) \w+
                        • Between one and unlimited times, as many times as possible, giving back as needed (greedy) +
                    • Match the character “ ” which occupies position 0x20 (32 decimal) in the character set \x20{3}
                      • Exactly 3 times {3}
                    • Match the regex below and capture its match into backreference number 3 (.+)
                      • Match any single character that is NOT a line break character (line feed, carriage return, form feed, next line, line separator, paragraph separator) .+
                        • Between one and unlimited times, as many times as possible, giving back as needed (greedy) +
                    • [Match the character “]” literally]3 \]
                    • Match the regex below and capture its match into backreference number 4 (\R)
                      • Match a line break (carriage return and line feed pair, sole line feed, sole carriage return, vertical tab, form feed, next line, line separator, or paragraph separator) \R

                    ${1}]${4}${2}${3}]${4}

                    • Insert the text that was last matched by capturing group number 1 ${1}
                    • [Insert the character “]” literally]4 ]
                    • Insert the text that was last matched by capturing group number 4 ${4}
                    • Insert the text that was last matched by capturing group number 2 ${2}
                    • Insert the text that was last matched by capturing group number 3 ${3}
                    • [Insert the character “]” literally]4 ]
                    • Insert the text that was last matched by capturing group number 4 ${4}

                    Created with RegexBuddy

                    A 1 Reply Last reply Feb 15, 2022, 10:17 PM Reply Quote 3
                    • A
                      Ashley Hoogenboom @Lycan Thrope
                      last edited by Feb 15, 2022, 10:16 PM

                      @lycan-thrope Thank you for your willingness to try and help me as well. I am new to this site as of last night, and I will be sure to follow the rules and make sure I am giving the correct sample. :-)

                      L 1 Reply Last reply Feb 15, 2022, 10:18 PM Reply Quote 1
                      • A
                        Ashley Hoogenboom @Alan Kilborn
                        last edited by Feb 15, 2022, 10:17 PM

                        @alan-kilborn Amazing! Thank you so much

                        1 Reply Last reply Reply Quote 1
                        • L
                          Lycan Thrope @Ashley Hoogenboom
                          last edited by Feb 15, 2022, 10:18 PM

                          @ashley-hoogenboom ,
                          All they can ask. I feel for these guys that do this day in and day out. You were my first attempt, and I was kind of angry when you changed the goal. :) That said, welcome to the NPP forum, community and ask away. The only stupid question, is the one not asked. :)

                          Lee

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