ruplacer
ruplacer copied to clipboard
Use capturing group next to literal
Proposed tag: question.
I want to make all class {Name}Test to be internal class {Name}Test, so I try to run:
ruplacer 'class (\w+)Test' 'internal class $1Test'
But it doesn't work as expected. I avoided it with
ruplacer 'class (\w+)(Test)' 'internal class $1$2'
But how can solve my issue without adding second capturing group?
@dmerejkowsky I am looking for help!
Try putting a question mark after the + to make it non-greedy.