MaskedTextBox: some RegEx is not working correct

Editors for WPF Forum

Posted 18 days ago by Siggi Ullrich
Version: 19.1.2
Platform: .NET 4.6
Environment: Windows 10 (64-bit)


we use a MaskedTextBox to allow only input specified by some RegEx.

This example does not work as expected:

shows this in the textbox:
IsCaseAutoCorrected = false;
IsCaseSensitive = true;
MaskKind = MaskKind.Regex;
PromptVisibility = MaskPromptVisibility.FocusedOnly;
Mask = "(?=(^.{0,63}$))(^([a-zA-Z][a-zA-Z0-9]*(-[a-zA-Z0-9]*)*)?$)";
Could you please verify this behaviour and show a possible workaround?

[Modified 18 days ago]

Comments (2)

Posted 16 days ago by Actipro Software Support - Cleveland, OH, USA


I'm sorry but you are using some advanced regex syntax like zero-width assertions that aren't supported by the control.  Please see this documentation topic for the list of supported regex syntax features:

[Modified 16 days ago]

Actipro Software Support

The latest build of this product (v21.1.3) was released 16 days ago, which was before the next post in this thread.
Posted 16 days ago by Siggi Ullrich

Thank you for the quick reply. 

In this case we have to implement that feature by ourselfes. 

Add Comment

Please log in to a validated account to post comments.