Hi Andrew,
When using RegularExpressionValidator, if the client-side javascript is
enabled and you enabled EnableClientScript, the regular-expression
validation occurs both client-side and server-side. However, the validation
implementation is slightly different on the client than on the server. On
the client, JScript regular-expression syntax is used. On the server,
System.Text.RegularExpressions.Regex syntax is used. Since JScript regular
expression syntax is a subset of System.Text.RegularExpressions.Regex
syntax, it's recommended that JScript regular-expression syntax be used in
order to yield the same results on both the client and the server.
Some changes to your regular exression:
1) The validation is alreay trying to match the whole expression,
therefore you don't need to specify ^ and $.
2) The regular expression options are all turned off by default, therefore
you don't need to specify "-msnx".
3) For the "ignore case" option, since .NET and JScript uses different
approach to specify this option, we have to use other workaround.
I've tested following regex and it works both client side and server side.
.+\.([jJ][pP][gG]|[gG][iI][fF])
Hope this helps.
Regards,
Walter Wang (
[email protected], remove 'online.')
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.