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].

Home 
  Java Book 
    Essential Classes  

Matcher:
  1. Regular Expression Processing
  2. Normal character
  3. Wildcard character
  4. Using Wildcards and Quantifiers
  5. Greedy behavior
  6. Working with Classes of Characters
  7. Using replaceAll( )
  8. Using split( )
  9. Matcher: appendReplacement(StringBuffer sb,String replacement)
  10. Matcher.appendTail(StringBuffer sb)
  11. Matcher: find()
  12. Matcher: group()
  13. Matcher: group(int group)
  14. Matcher: groupCount()
  15. Matcher: lookingAt()
  16. Matcher: matches()
  17. Matcher: replaceAll(String text)
  18. Matcher: start()