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
2 Answers 2
You have to escape the literal ( and )
TestBed.get\(([^)]*)\)
1 Comment
[^)] component ensures that the closing parentheses is not captured as part of the greedy capture group with *.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.
TestBed.get\((.*)\)