Creating Line Break when there are multiple spaces on tagged line.
-
Try:
find:
(?-s)^((\\[C2:)\w+)\x20{3}(.+)\\](\R)
repl:${1}]${4}${2}${3}]${4}
search mode: regular expression -
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
-
-
@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.
-
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
-
@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.
-
@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)
- 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 the character “” literally
- Match a single character that is a “word character” (Unicode; any letter or ideograph, digit, letter number, underscore)
\w+
- Match the regex below and capture its match into backreference number 2
- Match the character “ ” which occupies position 0x20 (32 decimal) in the character set
\x20{3}
- Exactly 3 times
{3}
- Exactly 3 times
- Match the regex below and capture its match into backreference number 3
(.+)
- [Match the character “]” literally]3
\]
- Match the regex below and capture its match into backreference number 4
(\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
- Use these options for the whole regular expression
-
@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. :-)
-
@alan-kilborn Amazing! Thank you so much
-
@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