Hello,
I am trying to validate email address in TextEditor by using regular expression but the result is not same as in online regexp tester and I don’t know why. I tried email address abc.abc@abc and it passed validation in TextEditor but in online regexp tester didn’t. I tried it in multiple online reqexp testers and every time the email address didn’t pass the validation which is correct. Another problem is when I type in bigger quantity of numbers e.g. ‘12345678912345679132456798134567981345665456476545648967564’ the page will freeze.
There is my code:
@(Html.Infragistics()
.TextEditor()
.ID("test")
.ValidatorOptions(options => options.OnBlur(true).RegExp(@"[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?"))
.Render()
)
Thank you
Hi Adam,
It's best to double check your regEx into any browser console. Simply
var v = new RegExp("[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?");v.test("abc.abc@abc")
If the last line returns true (which is the case) then the input is valid. That's similar to the validation into our widget. We rely on javascript RegExp, so if your input is valid due to their implementation, our validator won't fail.
Thanks,
Hello Adam Kopriva,
Please let us know if you have any other questions or concerns about this and we will be glad to help you.