Hi Community,
I am trying to use the AIMMS RegexReplace function to trim the folder path and keep the data case name. It’s working fine locally but it’s not working when testing in the server.
My code looks like this:
        block ! Get the full path for the Active Case File
            _sp_ActiveCasePathName := FormatString("%s", CaseFileURL(CurrentCase));
            !Check for server vs local. Local path won't likely contain the string 'PRO:/PublicDta'
            !example server path: PRO:/PublicData/Cases/spot_fw
            _bp_IndicateLocalFileName := not (RegexSearch(_sp_ActiveCasePathName,         "PRO:\\\\PublicData"));
            ! Text example _sp_ActiveCaseName := "C:\GitHub\spot-fw\Model Folder\data\DataCase_C5AgeTest_Output.data"
            ! This Removes the structure 
            !local: C:\\Location_of_File\With general\ideas-of-how\afilesnamewouldbe\ 
            !in the server: pro:/PublicData/Cases/FW SPOT Testing/
            !before the actual file name
            if _bp_IndicateLocalFileName then
                _sp_ActiveCaseName := RegexReplace(_sp_ActiveCasePathName, "C\\:\\\\([\\-\\_\\ [:alnum:]]+\\\\)+", "");
            else
                _sp_ActiveCaseName := RegexReplace(_sp_ActiveCasePathName, "[Pp][Rr][Oo]\\:\\\\([\\-\\_\\ [:alnum:]]+\\\\)+", "");
            endif;
        endblock;
        block ! Get the full path for the Active Case File
            _sp_ActiveCasePathName := FormatString("%s", CaseFileURL(CurrentCase));
            !Check for server vs local. Local path won't likely contain the string 'PRO:/PublicDta'
            !example server path: PRO:/PublicData/Cases/spot_fw
            _bp_IndicateLocalFileName := not (RegexSearch(_sp_ActiveCasePathName, "PRO:\\\\PublicData"));
            ! Text example _sp_ActiveCaseName := "C:\GitHub\spot-fw\Model Folder\data\DataCase_C5AgeTest_Output.data"
            ! This Removes the structure 
            !local: C:\\Location_of_File\With general\ideas-of-how\afilesnamewouldbe\ 
            !in the server: pro:/PublicData/Cases/FW SPOT Testing/
            !before the actual file name
            if _bp_IndicateLocalFileName then
                _sp_ActiveCaseName := RegexReplace(_sp_ActiveCasePathName, "C\\:\\\\([\\-\\_\\ [:alnum:]]+\\\\)+", "");
            else
                _sp_ActiveCaseName := RegexReplace(_sp_ActiveCasePathName, "[Pp][Rr][Oo]\\:\\\\([\\-\\_\\ [:alnum:]]+\\\\)+", "");
            endif;
        endblock;
Any ideas/help on what might be going wrong with the server file structure?
Thanks in advance!