A regular expression that consists solely of If a and b are regular expressions, then
a | b

 

 

(union) is the regular expression, that matches all input that is matched by a or by b.

a b

 

 

(concatenation) is the regular expression, that matches the input matched by a followed by the input matched by b.

a*

 

 

(kleene closure) matches zero or more repetitions of the input matched by a

a+
is equivalent to aa*
a?
matches the empty input or the input matched by a
a{ n}

 

 

is equivalent to n times the concatenation of a. So a{4} for instance is equivalent to the expression a a a a. The decimal integer n must be positive.

a{ n,m}

 

 

is equivalent to at least n times and at most m times the concatenation of a. So a{2,4} for instance is equivalent to the expression a a a? a?. Both n and m are non negative decimal integers and m must not be smaller than n.

( a )
matches the same input as a.
In a lexical rule, a regular expression r may be preceded by a '^' (the beginning of line operator). r is then only matched at the beginning of a line in the input. A line begins after each \r|\n|\r\n and at the beginning of input. The preceding line terminator in the input is not consumed and can be matched by another rule.

 Return to Using JFlex