If you look at the javadoc for
Pattern.MULTILINE, it only affects the meaning of ^ and $, which aren't relevant for Chaz's expression. The one that
is relevant here is
Pattern.DOTALL. Note that it's not necessary to use the Pattern and Matcher class directly - you can also use the poorly-documented flags allowed by the (?idmsux) construct (look at
Pattern's "special constructs" section). To get the effect of Pattern.DOTALL, just use (?s). Quoth the API: "The s is a mnemonic for 'single-line' mode, which is what this is called in Perl." Obviously this mnemonic suggests the complete opposite of what the flag actually does, which suggests that someone in Perl regex development was smoking crack or something, and the
Java folks also failed to fix this idiotic error. Anyway, if you ignore the drug-addled etymology, (?s) does what you want here. To give a more complete solution, try
[ August 12, 2007: Message edited by: Jim Yingst ]