使用正则表达式验证器时出现一些错误 [英] I got some errors while using regular expression validator

查看:64
本文介绍了使用正则表达式验证器时出现一些错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用正则表达式验证器进行mu文件上传器控制....我的代码在
下面

I want to use regular expression validator for mu file uploader control....my code is below

<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ErrorMessage="Only .doc , .docx or .txt files" ValidationExpression="^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+(.doc|.docx|.txt)$" ControlToValidate="ContractFile" ValidationGroup="OwnerSignUp">




但是它不起作用...请帮助我验证文件上传器的.doc,.docx和txt

[edit]已添加代码块-OriginalGriff [/edit]




but it is not working...plz help me to validate .doc,.docx and txt for file uploader

[edit]Code block added - OriginalGriff[/edit]

推荐答案

?)(\\(\ w [\ w].*))+(.doc | .docx | .txt)
?)(\\(\w[\w].*))+(.doc|.docx|.txt)


" ControlToValidate =" ValidationGroup ="


但是它不起作用...请帮助我验证文件上传器的.doc,.docx和txt

[edit]添加了代码块-OriginalGriff [/edit]




but it is not working...plz help me to validate .doc,.docx and txt for file uploader

[edit]Code block added - OriginalGriff[/edit]


尝试一个简单的表达式:
Try a simpler expression:
^.*?\.(doc|docx|txt)


这篇关于使用正则表达式验证器时出现一些错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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