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)
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 18 days ago]

Comments (2)

Posted 16 days 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 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
Avatar

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.