When replacing code on various documents, sometimes we face hard times, having to do it manually. This happens because the built-in ‘find and replace’ tools on development envoirnments are usually really simple and not programmable.
For example, if I have the following:
Jack's jeans is blue
Jack's hat is blue
Ron's T-shirt is blue
Ron's hat is grey
For some reason, I may want to change that to this:
Jack's jeans is red
Jack's hat is red
Ron's T-shirt is blue
Ron's hat is grey
I would like to know if there is some tool to specify something like “change every ‘blue’ to ‘red’ WHERE there is the word ‘Jack’ on the line”, because if I just say to the program “hey, change all ‘blue’ to ‘red'”, then Ron’s T-shirt will be red too, and I don’t want that to happen.
Hope you guys understand what I need
You just have to use your tools in a smarter way. In the find and replace, use regex mode, give appropriate regex ( something that would look for Jack in the same line) and change blue to red. Visual Studio and any IDE / Text Editor can do it.