Basic Regular Expression question

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

Trying to get started using the regular expression validator to validate
file name extensions in an file input box. I am falling at the first hurdle.
When I test for jpeg at the end of a string by using jpeg$ and then type in
'abc.jpeg' it won't accept it but when I put in 'jpeg' it will. What am I
doing wrong?
 
That works great but what do the .*\. sysbols mean. I can see them in my
text book but can't tie them to what you have done. Regards, Chris.
 
.. means "any character"
..* means "any character repeated any number of times"
\. means "literal . character"

you might want to use instead ".+\.jpeg$" where .+ means "at least one
of any character" otherwise the string ".jpeg" is a valid match.
 
Back
Top