TestProject Forum

How work ReGex validation?

Hello,

I want to test if there are a string inside my text so, with the getText and the validation I made this regex :
/(10\/2020|11\/2020|12\/2020|2021)/, it work well on regex101.

But it always fail, even with this one :
/(10\/2020)/, so how ReGex validation work ?

Thanks.

Hello @romain
What is the text the Get Text action returns?
Also, what are you trying to validate with the Regex?
Which string should it contain?

You can use the Contain validation instead unless it is something specific which requires Regex.

Hello @ran.tzur,

I have that :
Text = Last update : 28/10/2020
text does not match regular expression /(10/2020)/

I want to use contains but with an OR for exemple :
10/2020 OR 12/2020

Thanks for your quick reply !

Thanks, it does seem like an issue.
I have forwarded this to the developers to investigate.

This regex should work

image

Unfortunately, it doesn’t seem to work…

Capture

Hello @romain
Cloud you please try this one:

[a-zA-Z\s]*[0-9]{1,2}\/10\/[0-9]{4}|[a-zA-Z\s]*[0-9]{1,2}\/12\/[0-9]{4}

Please let me know.

Hello @dor.benzvi,

Thanks for your try !
I’m sorry I have the same error…

@romain This one should work:

[a-zA-Z:\s]*[0-9]{1,2}\/10\/[0-9]{4}|[a-zA-Z:\s]*[0-9]{1,2}\/12\/[0-9]{4}

I have added the: because I see you have this in your string.
Please make sure you include the chars in your language.
I can see there are different chars so please make sure you include them here:

image

Sorry, same error…

Text = Date de dernière mise à jour de la CRE : 28/10/2020

text does not match regular expression [a-zA-Z\s:\s]*[0-9]{1,2}\/10\/[0-9]{4}|[a-zA-Z\s:\s]*[0-9]{1,2}\/12\/[0-9]{4 }

I have tried with \s before and after : and with single space and without.

@romain

Can you email us at support@testproject.io so we can schedule a meeting to solve this issue?