Regular Expression!

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
 
C

Chris Fulstow

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
 
B

Bruno Piovan

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

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top