How to set Regex Expression as the Mask for a MaskedTextBox in C#? -


I want to set the maskedtexbox mask from Regex expression. Like I have to make a valid email, decimal value and other reggae expressions against the maskedtextbox.

For reference, it describes what you can do with a mask:

To set the mask from a regular expression, you can only be seen once if you do not have control over regular expressions, for example the masks obtained from the user or from the database are different from regular expression Are in the format and are not powerful then there may be some time It is possible, it can not be possible. As far as I know, you can not confirm something like an email with a mask, because the position and length of the different parts changes.

Rather than using a mask, you might use regular verification, and then you can directly use regular expression directly. Make sure the validity of the reason (Regular, not masked) text box is true, block the valid event and if the regular expression does not match, then cancel the event line set. Cancel the truth.


Comments