Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use capturing group next to literal #98

Open
Masynchin opened this issue Jul 29, 2022 · 2 comments
Open

Use capturing group next to literal #98

Masynchin opened this issue Jul 29, 2022 · 2 comments

Comments

@Masynchin
Copy link
Contributor

Masynchin commented Jul 29, 2022

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?

@Masynchin
Copy link
Contributor Author

Masynchin commented Aug 11, 2022

@dmerejkowsky I am looking for help!

@djmattyg007
Copy link

Try putting a question mark after the + to make it non-greedy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants