Validasi ASP.NET RegularExpressionValidator untuk tanggal / date dan Alamat / url website

Validasi untuk alamat website :

<asp:RegularExpressionValidator
ID=”RegularExpressionValidator3″
runat=”server” ControlToValidate=”TextBox2″
ErrorMessage=”Check URL Format”
ValidationExpression=”http://(%5b%5cw-%5d+%5c.)+%5b%5cw-%5d+(/%5b%5cw-./?%&=%5d*)?”>
</asp:RegularExpressionValidator>

Validasi untuk tanggal dengen format dd/mm/yyyy :

<asp:RegularExpressionValidator
ID=”RegularExpressionValidator2″
runat=”server” ControlToValidate=”TextBox2″
ErrorMessage=”Check Date Format”
ValidationExpression=”^(((0[1-9]|[12]\d|3[01])\/(0[13578]|1[02])\/((19|[2-9]\d)\d{2}))|((0[1-9]|[12]\d|30)\/(0[13456789]|1[012])\/((19|[2-9]\d)\d{2}))|((0[1-9]|1\d|2[0-8])\/02\/((19|[2-9]\d)\d{2}))|(29\/02\/((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))$”>
</asp:RegularExpressionValidator>

maaf [/source]

dalam wordpress tidak bisa mendukung kode ini, jadi saya jabarin secara visual …. ^.^

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s