How to find if number exists in between of 2 strings

Hello team,

I’m working on a string manipulation where I need to check if number exists between 2 strings.
I tried the following but it is not working for me:
InputStr: “Have been learning Uipath for 5 days.”
searchstr1: “Have been learning Uipath for "
searchstr2: " days.”

InputStr.contains(searchstr1+"[^0-9]"+searchstr2) = True/Falue

searchstr1 and searchstr2 is constant here, but the number value changes.
Could you please correct me here??

Thanks
Megh

Hi,

Contains method of String class does not support regular expression.
Perhaps you should use IsMatch Activity.

And Patten property in the activity may be the following.
searchstr1+"[0-9]+"+searchstr2

Regards,

Yoichi

thank you,
But what if I have inputStr= “Have been learning Uipath for 5 days. Thank you!!”
and searchstr2=" days."

Is this case, It should consider as True.

@Megh Use is match activity and pass pattern (\d)+ so this will give Boolean result.

1 Like

Hi,

The pattern " searchstr1+"[0-9]+"+searchstr2" returns true if number exists between 2 strings.
In your later case, IsMatch Activity will also return true, same as former case.

Regards,

Yoichi