Use the flags
static int
variable RE.MATCH_CASEINDEPENDENT to indicate that matching should be
case-independent (“fold” or ignore differences in case)
or RE_MATCH_NORMAL to request normal, case-sensitive matching
behavior. These flags can either be passed to the RE constructor
method, as in:
// CaseMatch.java RE r = new RE(pattern, RE.MATCH_CASEINDEPENDENT); r.match(input); // will match case-insensitively
or passed to the RE’s setMatchFlags( )
method before calling
match( )
, as in:
r.setMatchFlags(RE.MATCH_NORMAL); r.match(input); // will match case-sensitively If we print the results of both match operations + jikes +E -d . CaseMatch.java + java CaseMatch MATCH_CASEINDEPENDENT match true MATCH_NORMAL match was false
The full source for this example is online as
CaseMatch.java
.
18.191.93.12