c# - ASP.NET 3.5 : Allow tilde(~) in URL with the help of regex -
i have text box come in url. there validator set text box check if url entered in textbox valid.
i have used
<asp:regularexpressionvalidator id="valtargetformaturl" runat="server" controltovalidate="txttargeturl" validationexpression="(http|https)://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?" setfocusonerror="true"></asp:regularexpressionvalidator>
the above checks valid url not have special characters in (like ~,%). need look match '~'.
example: need look create ( http://www.domainname.com/~/xyz.pdf ) valid.
(http|https)://([\w-]+\.)+[\w-]+(/[\w- ./?%&=~]*)?
sorry error on part forgot add together ~ in expression
c# asp.net regex
No comments:
Post a Comment