A360 If Condition Regex Match Does Not Work as I expected
Hey ALL!
I am building a bot on A360, and I need to insert a if conditon to see if a string starts with the number “8”. In the If module of A360, I selected Regex Tool → Regex Match is Found. And my regular expression is ^8 in the field of “Regex ”, which should be able to match any string that starts with 8. However, it does not work as I expected. For example, I tested 800000 using the logic shown below. However, I got the message 800000 does not start with 8. I am so confused. I appreciate it if anyone can help me out.
Page 1 / 1
Hi,
I couldn’t see any options with Regex Match. Could you share the screenshot.
Thanks
Hi,
I created a test bot that has the following logic. First I created a list with the above shown numbers. And I loop through the list, for each element in the list, I have the condition as below
This does not work as all the strings in the list are classified as “not starting with 8”.
Hi,
We don’t have the option to match a string pattern like you have used in the code.
There is an alternate way, you can give it a try. Use the String → Find action and add your regex pattern, select “A regular expression” and the output will always be 1 if it matches otherwise it will be 0.
Thanks
It works! Thanks for solving my question.
@BruciiZ said “Thanks for solving my question”
@Diksha.M1 said “We don’t have the option to match a string pattern like you have”
I’m not sure that pointing the user in a different direction answered the problem with REGEX Tools.
I spent half a day trying to figure out REGEX Tools and why such a simple thing does not work:
The data to be identified are three decimal values separated by commas. They are to be used as RGB color codes. Valid values could be 000,000,000, or 000,00,0, etc. It’s a simple regex pattern: \d{1,3},\d{1,3},\d{1,3}.
The REGEX Tools: Extract a Regex Match (\d{1,3},\d{1,3},\d{1,3}) identifies it and returns the group value, 000,00,00. That is good.
String:Find using regex \d{1,3},\d{1,3},\d{1,3} also find it and returns 1 as the location where it was found.
But I cannot figure out what is expected to be coded in If Regex Match to make it work. I’ve coded it with and without parenthesis, and yet it fails.
The statement “We don’t have the option to match a string pattern” is concerning. Is it not just shipping the regex pattern to a regex engine? REGEX Tools shouldn’t have to worry about an option to match; that is the responsibility of the engine.
What engine is being employed: python, java, .net? Each has their subtle quirks.
I’ve had to abandon REGEX Tools because I cannot figure it out.
Hi @BruciiZ , You can try this regex ^8\w*|8\w*|\b8\w*\b