I've been trying to read about and test various regular expression testers to find my solution but to no avial. I'm using:
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" 
ErrorMessage='<%# "*"%>' ValidationExpression="," runat="server"
ControlToValidate="edit_email" Display="Dynamic" 
EnableClientScript="true"></asp:RegularExpressionValidator>
All I want to do is find out if there is a comma in the textbox, which this leads me to believe it would do. I tested this on http://www.regular-expressions.info/javascriptexample.html, as I understand that EnableClientScript="true" 开发者_开发知识库means I need to have JavaScript compliant RegEx
Any help would be greatly appreciated, here are the other things I've tried:
- ValidationExpression=".*\,"Which only hides the error message when I have a string followed by a comma at the end: "123,"
- ValidationExpression=".*,"Which only hides the error message when I have a string like: "123,"
- ValidationExpression=","Which only hides the error message when I have a string like: "," (only one character, and MUST be a comma)
- ValidationExpression="[^,]"Which only hides the error message when I have a string like: "1" (only one character, and must NOT be a comma)
- ValidationExpression="/,/"Which never hides the error message
Try this:
ValidationExpression="[^,]*"
That means "zero or more characters, none of which may be a comma"
How about .*,.* ? Do you want to know if there is at least one comma or exactly one comma?
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论