String Separation Using IsMatch

So, I’m trying to separate the amount as mentioned in the last post.
I’m using the IsMatch activity to check the condition and put it in the If loop to extract the substring.
The issue I have is, the input could be either $345 or USD345 or even 345, both of them have to be separated accordingly.
I have used two IsMatch activities to match these conditions, but when it goes to the If loop, it is running both the Ifs. How can I just make it enter one loop? Also if the input is 345, it has to give “enter proper format”, which is there in the else part.
Suppose I give the input as 345, it gives and 345 and “enter proper format” (which is from the other if loop)
Suppose I give the input as USD345, it gives “enter proper format” first which is in the first if loop and then USD and 345.
How do I make this right?

I have uploaded pictures of my workflow.
Thanks in advance!

1 Like

Kindly use this expression to get that numerical value
str_output = System.Text.RegularExpressions.Regex.Match(str_input,”[\d]+”).ToString

Cheers @Amrita_Narayan

This one worked. But that’s not the answer to my question, right?

hi @Amrita_Narayan

i am not sure with your question but what i understood is you just want to get the number,
and remove the USD or $ symbols.

if above is the case then use below regEX,

regx = “^[0-9]+”

then chek if the input is matching or not using IS Match activity which returns a Boolean.
then you can proceed with your logic



\w matches any word character such as alphabet and numeric etc.

So, I suppose you should use [a-zA-Z] instead of \w in IsMatch Activity which returns isLetters variable.