MaskedTextBox: some RegEx is not working correct

Editors for WPF Forum

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

Hello,

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

This example does not work as expected:

(?=(^.{0,63}$))(^([a-zA-Z][a-zA-Z0-9]*(-[a-zA-Z0-9]*)*)?$)
 
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?
Regards,

[Modified 3 years ago]

Comments (2)

Posted 3 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

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:

https://www.actiprosoftware.com/docs/controls/wpf/editors/other-controls/maskedtextbox

[Modified 3 years ago]


Actipro Software Support

Posted 3 years ago by Siggi Ullrich
Avatar

Thank you for the quick reply. 

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

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.