Regular Expression!

  • Thread starter Thread starter Adam J Knight
  • Start date Start date
A

Adam J Knight

Hi all,

I am trying to use the regular expression validator control (1.1).

My code so far:

<asp:regularexpressionvalidator id="regexValQuestionImage"
ControlToValidate="fleGraphic"
Display="None"
ErrorMessage="Invalid image type (gif/jpeg) only."
ValidationExpression=".+\.(gif|GIF|Gif|jpe?g|JPE?G|Jpe?g)"
runat="server"/>

What i want to do is modify the regular expression to allow the text to be
case insensitive? ie( .gif, .GIF, .Gif, .GiF ect).

Anyone got some ideas??

Cheers,
Adam
 
You might be able to prefix the expression with "?i:" to specify
case-insensitivity:

"?i:.+\.(gif|GIF|Gif|jpe?g|JPE?G|Jpe?g)"

However, you'll probably need to set EnableClientScript to false for
this to work.

HTH,

Chris
 
try this

^([a-zA-Z].*|[1-9].*)\.(((j|J)(p|P)(g|G))|((j|J)(p|P)(e|E)(g|G))|((g|G)(i|I)(f|F)))$

Bruno
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top