MaskedTextBox: some RegEx is not working correct

Editors for WPF Forum

Posted 11 months 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 11 months ago]

Comments (2)

Posted 11 months 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 11 months ago]

Actipro Software Support

Posted 11 months ago by Siggi Ullrich

Thank you for the quick reply. 

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

The latest build of this product (v22.1.2) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.