I have a string
@echo Setting environment for using the GDAL Utilities.
set GDAL_PATH="G:\MapTiler"
@echo GDAL path is %GDAL_PATH%.
set PATH=%GDAL_PATH%;%PATH%
in this i want to extract "G:\MapTiler" and replace it with "c:\gdal\bin"
for that i need QRegExp.
thanks
You should use the QString::replace() method for this:
QString gdalPath;
gdalPath.replace(QRegExp("G:\\MapTiler"),"c:\\gda\\bin");
But if the string being replaced does not even change, do not use regex, use string replace:
gdalPaht.replace("G:\\MapTiler","c:\\gda\\bin");
Edit for changing paths:
QString::replace(QRegExp("set GDAL_PATH=\"[^\"]*\""),"set GDAL_PATH=\"c:\\gda\\bin\"");