Getting an error when trying to reterive data.

I have created a nested statement
api:set attr="detailsIn.URITemplate" value="[urlbase]/api/Budget/{projectNumber}/currentbudget?api-version=1.0" />
I think its because of a blank space after the project number 123456
All other projects in TX log comes without a blank space
2025-01-23T11:48:43.178+01:00 2 [JSON] Reading JSON file at https://baseurl/Budget/123456 /currentbudget?api-version=1.0
2025-01-23T11:48:43.184+01:00 2 [53|Q-Id] [HTTP|Req: 1457] GET https://baseURL/Budget/123456 /currentbudget?api-version=1.0
I have tried to remove blank spaces with following code but its not working.
Anyone has a suggestion?
<api:script method="GET">
<api:call op="jsonproviderGet" in="touchIn" out="touchOut">
<!-- Remove all blank spaces from projectNumber and store in a variable -->
<api:set attr="cleanedProjectNumber"
value="[touchOut.projectNumber | replace('\\s+', '')]" />
<!-- Use the cleaned projectNumber in the URI -->
<api:set attr="detailsIn.URI"
value="[detailsIn.URITemplate | replace('{projectNumber}', [cleanedProjectNumber])]" />
<api:call op="jsonproviderGet" in="detailsIn" out="detailsOut">
<api:set attr="out.projectRecord" value="[detailsOut.ProjectRecord| allownull()]"/>
<api:push item=out/>
</api:call>
</api:call>
</api:script>