Regex condition when no match is found


I have a regex equation.The equation works fine if there is a match but sometimes the reference word is also not present in the text file. So i have given a if condition as string.isNullorEmpty(Regexresult(0).tostring).But this equation is throwing me an error if the reference word is not present .what is the solution for this?


Which type is your Regexresult?

If it’s MatchCollection type the following will work.


Hi @amruta_George

Add Not to, if condition like Not String.isNullorEmpty(Regexresult(0).tostring)

Hello @amruta_George .
Are you using Regex Matches? If yes, try with the regex Match expression.
For more understanding, kindly share the screenshots and regex expression you are using.

hi @amruta_George

You can give condition with regex

System.Text.regularExpressions.Regex.isMatch(StringVar,"your pattern")

Will return matches found or not.

Or you can directly use Is Match Activity

You can use like
If condition use the expression above or the activities variable

  • True-> Get the matches values




Can you elaborate how you have done this

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