Hi MS Techie,
Unfortunately, Azure Logic Apps built-in functions have the below considerations on your use case:
- Logic Apps does not support regular expressions.
- JavaScript inline code action to remove special characters require an automation account and It doesn't support get variable as arguments.
So you have alternatives solution to remove this characthers:
- Create an Azure Function in a supported language (like JavaScript or C#) that takes a string as input, removes special characters using a regular expression, and returns the cleaned string.
- Create an HTTP Trigger eather to your Azure Function or another APi service that it can be called via an HTTP request to remove the special characters
- Last workaround with Javascript inline code action and workflow context but require an automation account
Remove special character with javascript inline code action:
Asociate the Integration account to logic apps on workflow settiong (This automation account must to be in the same azure region)
This is an example workflow removing the special characters :
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Execute_JavaScript_Code": {
"inputs": {
"code": "var reg = /[^a-zA-Z0-9]/g;\r\nvar nospecial = workflowContext.actions.variable.inputs.variables[0].value;\r\nreturn nospecial.replace(reg, '');"
},
"runAfter": {
"variable": [
"Succeeded"
]
},
"type": "JavaScriptCode"
},
"variable": {
"inputs": {
"variables": [
{
"name": "specialVariable",
"type": "string",
"value": "NoSpecial$$%%^&&>-?+yes"
}
]
},
"runAfter": {},
"type": "InitializeVariable"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {},
"triggers": {
"Recurrence": {
"evaluatedRecurrence": {
"frequency": "Month",
"interval": 3
},
"recurrence": {
"frequency": "Month",
"interval": 3
},
"type": "Recurrence"
}
}
},
"parameters": {}
}
The execution will be successfull:
I hope this information help you.
Luis