• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

issue with pattern [A-Z,0-9] in html

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a input box defined in HTML.

The limit on number of characters allowed in the box is 10.

I only want to allow the characters A-Z and 0-9 in the box.

I want to define the pattern for that.

[A-Z,0-9] is not working. It is behaving as if it is defined for only the first character. e.g. ! is not allowed. But 2@ is allowed.

[A-Z,0-9]* is also not working.

I don't want to do [A-Z,0-9][A-Z,0-9][A-Z,0-9][A-Z,0-9]..... 10 times to define pattern for each of the 10 characters.

Please help.
 
Greenhorn
Posts: 27
Eclipse IDE Oracle Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Vicky
if you want user to input minimum 10 values then you can use Following Regular Expression


This will make sure user will have to enter 10 Correct Values.Even if user enters 4 correct values the validation will fail since the pattern requires 10 input values.

if you want it in range.for example user can enter minimum 2 and maximum 10 values then the regular expression will be



Hope this will solve your problem.

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic