Normal character
A normal character is also called a literal. A normal character is matched as-is. Thus, if a pattern consists of "xy", then the only input sequence that will match it is "xy".
Characters such as newline and tab are specified using the standard escape sequences, which begin with a \. For example, a newline is specified by \n.
Character class
A character class is a set of characters. A character class is specified by putting the characters in the class between brackets.
For example, the class [wxyz] matches w, x, y, or z.
To specify an inverted set, precede the characters with a ^. For example, [^wxyz] matches any character except w, x, y, or z.
You can specify a range of characters using a hyphen. For example, to specify a character class that will match the digits 1 through 9, use [1-9].
Java Book
Essential Classes
- Regular Expression Processing
- Normal character
- Wildcard character
- Using Wildcards and Quantifiers
- Greedy behavior
- Working with Classes of Characters
- Using replaceAll( )
- Using split( )
- Matcher: appendReplacement(StringBuffer sb,String replacement)
- Matcher.appendTail(StringBuffer sb)
- Matcher: find()
- Matcher: group()
- Matcher: group(int group)
- Matcher: groupCount()
- Matcher: lookingAt()
- Matcher: matches()
- Matcher: replaceAll(String text)
- Matcher: start()