I have below predefined email format but issue im going through is if there any invisible spaces and unnecessary characters in the incoming email then below flow is not working,please revert incase of any details.
Email template which arrives with below format //Incoming email format
When we recieve incoming Email with below predefined email format then in my flow i have put indexes as per it works ,please see my flow but i need some help to remove unnecessary blank spaces from email . im not sure how to remove blank spaces in the new email .
Indexes fixed: //so its working but at the same time if its blank spaces exceeds below indexes values its failed
variable 3 expression :last(split(outputs('Compose_2')[6],': '))
variable 4 expression: last(split(outputs('Compose_2')[8],': '))
variable 5 expression: last(split(outputs('Compose_2')[12],': '))

Input data structure
Contract_List:

Customer-single line of text
Location- single line off text
Typeofcontract-Single line of text
From-single line of text
To-single line of contract
document library

Complete Flow details:

Detailed flow steps:


compose 2 expression-
split(outputs('Html_to_text')?['body'],outputs('Compose'))


Detailed step by step condition flow steps
Yes branch flow steps

variable 3 expression :last(split(outputs('Compose_2')[6],': '))
variable 4 expression: last(split(outputs('Compose_2')[8],': '))
variable 5 expression: last(split(outputs('Compose_2')[12],': '))


create new folder2 expression : concat(variables('Location'),'/',variables('Customer'))

create new folder 3 expression:
concat(variables('Location'),'/',variables('Customer'),'/',formatDateTime(utcNow(),'yyyy'))
create new folder 4 expression:
concat(variables('Location'),'/',variables('Customer'),'/',formatDateTime(utcNow(),'yyyy'),'/',formatDateTime(utcNow(),'MMMM'))

set variable 2 expression:
concat(variables('Location'),'/',variables('Customer'),'/',formatDateTime(utcNow(),'yyyy'),'/',formatDateTime(utcNow(),'MMMM'))

create new folder 5 expression:
concat(variables('VarPath'),'/',variables('VarType'))
No branch: