Regex result showing null values

I am attempting to retrieve an OTP from email using regex,but it encountering null values in the results.i also checked with regex 101.
image

(?<=is\s).*[0-9]

if is is constant or any word is constant we can get it like this
image

please try this
usha

Hi @chandrakala.productanalys

Use this website to write regex. Not all expressions in regex101 work in UiPath studio.

Hi @chandrakala.productanalys

image

I have checked it
it worked

Find matching pattern activity output showing null values.

sometimes match activity may not work
so take assign activity
left side create a variable
and right side
use the below syntax
System.Text.RegularExpressions.Regex.Match(Str,“(?<=is\s).*[0-9]”).Value

Hope this helps
Usha

@chandrakala.productanalys

Try this and check the input string once:
(?<=is\s*)\d+

Hi @chandrakala.productanalys

Input= "one time password is 151743"
Output= System.Text.RegularExpressions.Regex.Match(Input,"\d+").Value

Hope it helps!

Hi @chandrakala.productanalys

Check the properties of Find Matching Patterns activity: Since there is only single match you can store the output by creating a variable in First Match.

Check below image for better understanding.

or else use this both in Assign Activity:

Input= "one time password is 151743"
Output= System.Text.RegularExpressions.Regex.Match(Input,"\d+").Value

Both Input and Output are of DataType System.String.
Hope it helps!!

Hi @chandrakala.productanalys ,

If you are still facing issues would request to share the implementation done from your end, so we could analyse and correct any parts if required.


image

@chandrakala.productanalys ,

Would also ask you to check in the Debug Panel the input data that is being supplied to Activity.

@chandrakala.productanalys

Are you recieving the one time password in the body of the mail right. In the Text to search in give currentItem.Body it will take only the body part.

Regards,

While running in debug,showing the firstmatch value as Null

@chandrakala.productanalys ,

Input data was asked to check and maybe also provide its screenshot to us.

I tired to add it shows like option strict on disallows late binding

@chandrakala.productanalys

Add it this way currentItem.Body.ToString.

Regards,

I tired no Luck.Same error

@chandrakala.productanalys

Can you share your workflow with sample input if possible.

Regards,

Thanks in advance