Replace pattern not working correctly
-
Hi again all – I was so proud of myself I was able to correctly select a block of text, but I’m not being able to do the replacement command correctly, so I’m sure my selection is wrong in some way. Here’s my starting text (and I have lots of these to do in the file):
Derro Maniac
The text is exactly 6 spaces (important, because I have other text with exactly 4 spaces I need to get rid of after I have this piece solved).
My target outcome would look like this:
### Derro Maniac
I’ve been able to successfully select the text using the following search string (regex).
(?<=\x20{6}).*$
But when I try to replace using this replace string, my original text is getting wiped out.
###\r\n\1
I get this result:
###
What am I doing wrong?
Thanks!
-
@Brennan-OBrien said in Replace pattern not working correctly:
Try
###\r\n${0}
as your replace string.But if you really want to know what is wrong with your replace string, I’ll tell you that you are trying to insert “group 1” (with your use of
\1
), but you have no group 1 captured in the find string. -
You could obtain a group one in your find string by changing it to:
(?<=\x20{6})(.*)$