I have a text file that looks something like this:


I'm trying to replace groups of 5 with the match and a line break for easy readability. So, I'm trying to do a regex match and replace.

Find What: ([\,]+[\']+[A-Z]{0,3}[\']+){5}
Replace With: \1\r\n

The above in Notepad++ (version 6.8.8) will find/match


but it replaces it with


I've also tried replacing with \1\2\3\4\5\r\n, and it yields the exact same result. Any ideas would be greatly appreciated.

  • What's the output you're expecting? – tachomi Jan 19 '16 at 16:02
  • I'm expecting it to replace ,'','a','bc','def','ghi' with ,'','a','bc','def','ghi'[CR][LF] – Jpsh Jan 19 '16 at 16:07

Replace With: $0\r\n ended up working I guess \1 was for versions before 6.

  • Nope - \1 is a first capturing group ([\,]+[\']+[A-Z]{0,3}[\']+) which you are matching 5 times, so \1 in replace capture the last match. (([\,]+[\']+[A-Z]{0,3}[\']+)) capture group is what you have been expected to match \1 while \2 is still the last '...' in line. However you have found better RegEx anyway... – g2mk Jan 21 '16 at 22:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.