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.
This is what I want as an output:
TCP
HTTP
Loop_Response
WEB_WebText_Wire
WEB_WebText_Wire_Net
Have you tried the formula I sent you the message before ? It should return that result.
I checked just now, it's working fine but say if a string has a numeric number in between or say just before or after the string it will not give the desired output.
For example:
0.WEB4 => WEB_ (But the desired output should be -> WEB)
1.WEB7TCP => WEB_TCP (But the desired output should be -> WEB7TCP)
"0.Loop.1.Response56" => Loop_Response_ (But the desired output should be -> Loop_Response56)
"0.WEB.2.Web7777Text.3.Wire33" => WEB_Web_Text_Wire_ (But the desired output should be -> WEB_Web7777_Text_Wire33)
So here it's removing numbers and appending the _ with string. So what we can do in these conditions.
Thanks
Here it is :
REGEX_Replace(REGEX_Replace(REGEX_Replace([Field1], "\.\d\.", "_"), "\d\.", ""), "^\d*([\l\u]*?)\d*$", "$1")
Hi @AKPWZ
Try the below formula
REGEX_Replace(
REGEX_Replace([Field1], "\.\d+\.", "_"),
"^\d\.", "")
Workflow:
Hope this helps : )
Hi @atcodedog05 thank you for teaching me and helping me to clear my doubts.
I used your regex and found one issue that if starting numbers are in 2 digits or more then it's failing.
For Ex:
10.PeopleID1 => 10.PeopleID1 (But the desired output should be => PeopleID1)
11.WEB7TCP5 => 11.WEB7TCP5 (But the desired output should be => WEB7TCP5)
Hi, @Jean-Balteryx thank you for your big help and for teaching me regex.
I tried your regex and found one issue that it removing the last integer from a string.
For Ex:
10.PeopleID1 => PeopleID (But the desired output should be => PeopleID1)
11.WEB7TCP5 => WEB7TCP (But the desired output should be => WEB7TCP4)
Thank you! 🙂
You can add a + next to the second \d in @atcodedog05 RegEx and it should be fine!
Hi @AKPWZ
Please try this
REGEX_Replace(
REGEX_Replace([Field1], "\.\d+\.", "_"),
"^\d+\.", "")
Workflow:
Hope this helps : )
Yes it's working absolutely fine now 🙌 thank you @Jean-Balteryx 🙂
Thank you @atcodedog05 🙂