I have a string field that looks like this "0.HTTP.2.WebText" (a JSON_Name field).
And I want to remove the unwanted character using regex or any other formula in my workflow to achieve the output.
The output should look like this - "HTTP_WebText".
Any idea how to solve this, please? Thanks.
Hi @AKPWZ
Give this a try
REGEX_Replace([Input], ".*(HTTP).*\.(.+)", "$1_$2")
Workflow:
Hope this helps : )
Hi @atcodedog05
Thank you so much for your response.
Just want to know how can I replace the HTTP string (hardcoded text) with an alphanumeric regex.
Coz I have only one row which contains HTTP text, but other rows contain different strings.
Ex:
"0.TCP.1.Error"
"0.HTTP.2.WebText"
"0.Loop.3.Response"
"0.WEB.4.WebText"
So, I used this "^[a-zA-Z0-9]+$" regex in place of "HTTP" but it's not working for me. Can you please guide me. Thanks
Hi @AKPWZ ,
I adapted @atcodedog05 right answer to suit your new need :
REGEX_Replace([Field1], ".*\.(.*)\..*\.(.+)", "$1_$2")
Hi @AKPWZ ,
Here is the Regex
REGEX_Replace([Field1], "\d+\.(\u+)\.\d+\.(.+)", "$1_$2")
Workflow:
Hope this helps : )
Wow, this is working fine for me @Jean-Balteryx @atcodedog05 Thank you so much 🙂 🙂
Just want to clear one more small doubt what if I have a trend of different kind of data then in that condition what changes will I make to achieve the same output?
For Ex:
"0.TCP"
"0.HTTP"
"0.Loop.1.Response"
"0.WEB.2.WebText.3.Wire"
"0.WEB.4.WebText.5.Wire.6.Net"
Thanks!
Do you which to get everything that is not digits ?
Hi @atcodedog05
Yes, Here is the expected output:
TCP
HTTP
Loop_Response
WEB_WebText_Wire
WEB_WebText_Wire_Net
Thanks!
Then try this formula :
TrimLeft(Replace(REGEX_Replace([Field1], "\d", "_"), ".", ""), "_")