Sun Java System Web Server 7.0 Update 3 Administrator's Configuration File Reference

Expression Operators

The following table lists the operators that are used in expressions.

Table A–2 List of Expression Operators

Operator Symbol 

Operator Name 

!

C-style logical not 

=

Wildcard pattern match 

=~

Regular expression match 

!~

Regular expression mismatch 

+

Addition or unary plus 

-

Subtraction or unary minus 

.

String concatenation 

defined

Value is defined 

-d

Directory exists 

-e

File or directory exists  

-f

File exists 

-l

Symbolic link exists 

-r

File is readable 

-s

File size 

-U

URI maps to accessible file or directory 

<

Numeric less than 

<=

Numeric less than or equal to  

>

Numeric greater than 

>=

Numeric greater than or equal to 

lt

String less than 

le

String less than or equal to 

gt

String greater than 

ge

String greater than or equal to 

==

Numeric equal 

!=

Numeric not equal  

eq

String equal 

ne

String not equal 

^

C-style exclusive or 

&&

C-style logical and 

||

C-style logical or 

not

Logical not 

and

Logical and 

or

Logical or 

xor

Logical exclusive or 

The following table lists the precedence of operators within expressions from highest to lowest precedence.

Table A–3 Operator Precedence

Symbol 

Operands 

Associativity 

Description 

( ), [ ]

Left to right 

Parentheses 

!, unary +, unary -

Right to left 

Sign operators 

=, =~, !~

Non-associative 

Pattern matching operators 

+, -, .

Non-associative 

Additive operators 

defined, -d, -f, -l, -r, -s, -U

Right to left 

Named operators 

<, lt, <=, le, >, gt, >=, ge

Non-associative 

Relational operators 

==, eq, !=, ne

Non-associative 

Equality operators 

^

Left to right 

C-style exclusive or operator 

&&

Left to right 

C-style logical and operator 

||

Left to right 

C-style logical or operator 

not

Right to left 

Logical not operator 

and

Left to right 

Logical and operator 

or, xor

Left to right 

Logical or operators 

The numeric operators (<, <=, >, >=, ==, and !=) are intended to operate on numbers and not strings. To facilitate comparing numbers, dates, and timestamps, the numeric operators ignore any white space, colons, slashes, and commas in their arguments. Dashes after the first digit are also ignored.


Note –

It is generally incorrect to use the numeric operators on non-numeric values.


For example, the following expression evaluates to true:

# The following expression evaluates to true because both
# "foo" and "bar" are numerically equivalent to 0
("foo" == "bar")