asp.net - Regular Expression Validation not allowing string type ab ,cd -


i using regular expression validator in application.

<asp:regularexpressionvalidator id="regularexpressionvalidator3" runat="server" validationgroup="notes" controltovalidate="txtnotes" errormessage="invalid notes input!" validationexpression="[a-za-z0-9]*"></asp:regularexpressionvalidator>. 

when enter text "ab ,cd" in textbox shows error message "invalid notes input!" . while takes string "ab, cd" , ""ab,cd".

thanks

i enter text "ab ,cd" assuming want accept space , comma

your expression should be

 validationexpression="^[0-9a-za-z, ]+$" 

Comments