Recognising brackets as a returned result

I need some help which probably involves regex.

The scenario i have is there are 3 possibilities of returned results and all 3 lead to different scenarios

Returned results can be

(0.09) - this is considered a negative number
0.09 - this is considered a positive number
0.00 - this is considered the best outcome

How do i code the bot to recognise either of the scenarios and if it is the first two then create an output that offsets it back to 0 e.g. if it is (0.09) it should enter 0.09 in another field to balance it back to 0.00. and if its 0.09 then type in -0.09 in another field.

0.09 is just an example it can be any number, the number in () indicates its negative, no brackets is positive.

Hi @Adeel_Ahmed

Use the following Regex in your IF condition

Regex.isMatch(YourValue,"(^(\d{0,}.\d{2}))" Match Negative Number
Regex.isMatch(YourValue,"(^[0-9]{0,}.[0-9]{1}[1-9]{1})" Match Positive Number
Regex.isMatch(YourValue,"(^[0]{0,}.[0]{2}$)" Match Best outcome

Happy Automation

Hey Saman thanks for the reply, would this be for 3 IF statements? Im guessing its not possible to have it in one?

Hi @Adeel_Ahmed,

You can do it in a single If statement check positive and negative values and make positive goes in True path and negative goes in False path Ignore Best out come you don’t wont to do anything for Best outcome no

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.