Regular expression (regex) is a powerful method for pattern matching and replacement within many programming languages, and is outside the scope of this book (a good starting point is the javadocs for regex patterns at http://docs.oracle.com/javase/1.4.2/docs/api/java/util/regex/Pattern.html). One interesting use for regular expressions is when dealing with unusual input formats that are difficult to describe using normal delimited or fixed-width file formatting. This recipe shows how regex can be used to identify a set of input columns from an unstructured input row.
The screenshot of the
chapter8_jo_0020_jobLogData.txt file is as follows:
You should notice that there is neither an obvious delimiter, ...