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 ManiacThe 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 ManiacI’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\1I 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})(.*)$
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