Wildcard in Custom Replace Pattern
Hello,
I am trying to make a custom replace pattern that will detect if a variable name of a specific type is not a specific string. The idea is to use it to enforce that across the whole code base, a common object that gets initialized is done so using a consistent name.
I have this working right now:
https://i.imgur.com/VKzNbNX.png
The part that I highlighted red could be dynamic using a different method, so I was wondering if there is a way to allow the highlighted section to be anything instead of hardcoding and whenever the replace happens, it just puts whatever was there in the highlighted section back there in the replacement pattern.
I tried something like this, trying to treat the second half as an identifier (I tried with a few regex permutations that match the entire string no matter what it is):
https://i.imgur.com/XqBh8SL.png
This didn't seem to work though.
Let me know if anyone has suggestions on how to make this work in a more dynamic fashion!
Regards,
Kevin
Please sign in to leave a comment.
Hello Kevin,
Please try add an expression placeholder on the right side.
For example
IOrganizationService $variableName$ = $method$;
Where $method$ is the expression placeholder added like this: