This tutorial explains how to use Java's Pattern class in the regex API to match patterns in strings.
tutorials.jenkov.com