0

what is the most efficient regex (vim/perl) to replace 100 'a' characters with 300 'b' characters. I can get the search part correct :%s/a\{100}/?????? but the 'replace' portion eludes me.

1 Answer 1

1

This can be done with :%s/a\{100}/\=repeat('b',100)/

2
  • that does it. i'd been using the search form in the replace portion and just did not work. i don't know how to mark this as the correct answer, but it does exactly what i was looking for. thanks. Nov 22, 2018 at 1:19
  • @iohannfust click the greyed-out check mark next to the answer to mark it as “accepted”
    – D. Ben Knoble
    Nov 22, 2018 at 3:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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