The new regular expression language is used with JavaStar API methods that have names end with RE
. For example, JSComponent.hasMemberRE()
and JS.dialogRE()
both use this syntax.
This language is a subset of Perl's regular expressions, similar to UNIX egrep.
A regular expression can consist of one or more alternatives. An alternative is a sequence of items. Alternatives are separated by |
(the pipe symbol). An alternative matches if all the items match in the order they occur. The regular expression matches if any of the alternatives match.
An item is either an assertion or a quantified atom. Assertions are:
Expression | Use |
---|---|
\b
|
Matches on word boundary, between \w and \W or between \W and \w .
|
\B
|
Matches on non-word boundary. |
A quantified atom is an atom followed optionally by one of the following which indicate how many times the atom must or may occur. If no quantifier is given, the atom must occur exactly once.
Quantifiers are:
Expression | Use |
---|---|
*
|
0 or more times |
+
|
1 or more times |
?
|
0 or 1 time |
An atom is:
.
matches any character except \n
[ ]
matches one of a class of characters. A caret ^
at the front of the list negates the class. Character ranges may be indicated with a hyphen -
, such as a-z
. You may also use any of \d \w \s \n \r \t \f
. Backslash can be used to escape - ] ^
to prevent their special meaning.
Regular expression syntax not included are:
Send feedback to
JavaStar-feedback@suntest.com
Copyright © 1998
Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, CA 94303.
All rights reserved.