Devex preSS文本定期EX pression验证不正确验证 [英] Devexpress textbox regular expression validator not validating correctly

查看:218
本文介绍了Devex preSS文本定期EX pression验证不正确验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于一些原因,我不得不使用devex preSS文本框,而不是ASP文本框和文本框有一个验证文本必须包含一个。,所以我使用普通的前pression验证用户的输入像如下:

For some reasons, I have to use devexpress textbox instead of asp textbox, and the textbox have a validation that the text must contain a ".", so I am using regular expression to validate the user's input like below:

<dx:ASPxTextBox runat="server" ID="textBox1"  ValidationSettings-ValidationGroup='<%# Container.ValidationGroup %>'>
                                                            <ValidationSettings>
                                                                <RegularExpression ValidationExpression="[.]" ErrorText="Invalid input" />
                                                            </ValidationSettings>
                                                        </dx:ASPxTextBox>

即。正则表达式非常简单,只需 []

我测试了正则表达式在这个网站 http://regexpal.com/ 和它的验证正确,但是当它把aspxTextbox,只要里面的任何东西的用户类型包含。,验证未通过(即错误文本显示),为什么出现这种情况?

I tested the regex on this site http://regexpal.com/ and it's validating properly, but when it's put inside the aspxTextbox, whenever the user type in anything that contains ".", the validation isn't passed (i.e. error text shows), why this happens?

推荐答案

刚刚尝试下面的正则表达式,使您的验证获得通过。

Just try the below regex to make your validation getting passed.

^.*\..*$

说明:


  • ^ - 断言,我们在开始。为了验证目的,我们必须给予开始和结束模式。

  • * 。 - 匹配任何字符零次或多次

  • \\ - 匹配文字圆点

  • * 。 - 匹配任何字符零次或多次

  • $ - 电话那端

  • ^ - Asserts that we are at the start. For validation purposes, we must give the start and end patterns.
  • .* - Matches any character zero or more times.
  • \. - Matches a literal dot.
  • .* - Matches any character zero or more times.
  • $ - End of the line.

这篇关于Devex preSS文本定期EX pression验证不正确验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆