0

I want to do a global find of all instances of

TestBed.get(*)

and replace with

TestBed.inject<*>(*)

I can't seem to figure out the regex I need to just match what is between the brackets

I have tried TestBed.get(.*) and replace with TestBed.inject<1ドル>(1ドル) but the ends up with an extra set of brackets

asked Jul 22, 2020 at 3:39
1
  • 1
    Try TestBed.get\((.*)\) Commented Jul 22, 2020 at 3:47

2 Answers 2

2

You have to escape the literal ( and )

TestBed.get\(([^)]*)\)
answered Jul 22, 2020 at 3:48
Sign up to request clarification or add additional context in comments.

1 Comment

For reference, the [^)] component ensures that the closing parentheses is not captured as part of the greedy capture group with *.
0

In TestBed.get(.*) the brackets are considered for making the groups. So you need to escape those. Try finding this instead:

TestBed.get(\(.*)\)

Also instead of a wild card pattern, you may want to use more precise patterns to match the contents inside the brackets.

answered Jul 22, 2020 at 3:51

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.