JSP CUSTOM TAG LIBRARIES


validatepattern tag
Example

Specifies that the formatting of the value supplied by the user in the specified input field must match the specified pattern. If validation fails, the body of this tag is evaluated.

Be sure the clientvalidate attribute of the input tag you are validating does not equal "none." The clientvalidate attribute of the form tag containing the input tag should be set to "true."

Contexts

Valid in:


Syntax
Attributes

alert


bundle
locale
message
msgkey
name
onalert
pattern
See the Common Domino JSP tag attributes section for definitions of debug, onfailure, and time.

HTML Attributes

See the Common HTML tag attributes section for definitions of the following standard HTML tag attributes:


Regular expression syntax

Characters

CharacterDefinition
unicodeCharMatches any identical unicode character
\Quotes a meta-character (like '*')
\\Matches a single '\' character
\0nnnMatches a given octal character
\xhhMatches a given 8-bit hexadecimal character
\uhhhhMatches a given 16-bit hexadecimal character
\tMatches an ASCII tab character
\nMatches an ASCII newline character
\rMatches an ASCII return character
\fMatches an ASCII form feed character

Character classes

ClassCharacter type
[abc]Simple character class
[a-zA-Z]Character class with ranges
[^abc]Negated character class

Standard POSIX character classes

ClassCharacter type
[:alnum:]Alphanumeric
[alpha:]Alphabetic
[:blank:]Space and tab
[:cntrl:]Control
[:digit:]Numeric
[:graph;]Printable, but not visible (a space, for example)
[:lower:] Lower-case alphabetic
[:print:]Printable (not control characters)
[:punct:]Punctuation (not letters, digits, controls, or spaces)
[:space:]Space (tabs, line feeds, carriage returns, and spaces, for example)
[:upper:]Upper-case alphabetic
[:xdigit:]Hexadecimal digits

Non-standard POSIX-sytle character classes

ClassCharacter type
[:javastart:]Beginning of a Java identifier
[:javapart:]Part of a Java identifier

Predefined classes

ClassDefinition
.Matches any character other than newline
\wMatches a "word" character (alphanumeric plus "_")
\WMatches a non-word character
\sMatches a whitespace character
\SMatches a non-whitespace character
\dMatches a digit character
\D Matches a non-digit character

Boundary matchers

OperatorDefinition
^Matches only at the beginning of a line
$Matches only at the end of a line
\bMatches only at a word boundary
\BMatches only at a non-word boundary

Closures

All closure operators (+, *, ?, {m,n}) are greedy by default, meaning that they match as many elements of the string as possible without causing the overall match to fail. A reluctant closure matches as few elements of the string as possible when finding matches. If you want a closure to be reluctant, you can simply follow it with a '?'. {m,n} closures do not currently support reluctancy.

Logical operators

OperatorDefinition
ABMatches A followed by B
A|BMatches either A or B
(A)Used for subexpression grouping

Backreferences

A "backreference" refers to the contents of a parenthesized expression within a regular expression. The first backreference in a regular expression is denoted by \1, the second by \2 and so on. The following expression will match any string in the form n=n (like 0=0 or 2=2):

Example
See Also