Following is a simple program demonstrating how to use regular expression in Java.
JavaRegex Characters