Please read query carefully. What I want is to capture first occurrence of "Apple" after "C:" in the line. between C:\ and \Apple there can be anything.
Hence the solution provided by you is applicable only in the case where there is C:\India\Apple.
But in my various files it would not always be C:\India\Apple, it can be anything like
C:/India/Mango/Apple or C:/Mumbai/Jaipur/Mango/Apple
That means I want to replace the text starting from "C:\" till first occurrence of "\Apple\" by "D:/<some_dir>/Apple".
Between "C:\" and first occurrence of "\Apple" there can reside any text.
The output I am getting by using the above mentioned regex is that it takes the last occurrence of "Apple" in the line whereas I want the first occurrence of "Apple".
Thanks in Advance.
-----Post Update-----
Hi Franklin,
sorry for that but I meant to say to read the note carefully.
I am looking for a generic regex which would not search for a specific string but will capture till the first occurrence of the expected string i.e. "Apple" in this scenario.