Consider the following list of words:
targetX
targetY
targetZ
targetColor
targetWidth
I want to remove the "target" prefix, while maintaining the naming convention. This means that the first character after the prefix needs to be downcased:
x
y
z
color
width
So far I can match the text that I want and group the characters accordingly:
Find: "target[A-Z]"
Replace: ???
But I don't know what I can do for the replace. Is there a regex substitution function that can do this in Visual Studio, or an alternative editor?
Visual Studio S&R tool does not support upper-/lowercasing operators in the replacement part. The work around is to use Notepad++ or SublimeText with
Find: \btarget([A-Z])
Replace with: \l$1
Here, \btarget will match a word starting with target and ([A-Z]) will match and capture an uppercase ASCII letter into Group 1 that will later refernce with a $1 backreference and turn it lowercase with \l operator.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With