Java Reference
In-Depth Information
pattern.ignoreCase = false // this won't work
<< false
pattern.ignoreCase // has it changed?
<< true
The only way to change the ignoreCase property to false is to redefine the regular
expression:
pattern = /java/
Special Characters
In a regular expression, there are a number of characters that have a special meaning, com-
monly known as metacharacters :
. matches any character
\w matches any word character, and is equivalent to [A-Za-z0-9_]
\W matches any non-word character, and is equivalent to [^A-Za-z0-9_]
\d matches any digit character, and is equivalent to [0-9]
\D matches any non-digit character, and is equivalent to [^0-9]
\s matches any whitespace character, and is equivalent to [ \t\r\n\f]
\S matches any non-whitespace character, and is equivalent to [^ \t\r\n\f]
Modifiers
Modifiers can be placed after a pattern to match multiple occurrences of that pattern:
? matches zero or one occurrence of the pattern
* matches zero or more occurrences of the pattern
Search WWH ::




Custom Search