Pattern.DOTALL

If your woundering why your reqular expression isn’t matching against strings containing line terminators, the javadocs (as always) have the answer.

By default . does not match line terminiators, if you want it to you have to specify this explictly by passing the DOTALL flag when compiling the pattern;

Pattern p = Pattern.compile(”.*”, Pattern.DOTALL);

Nothing special.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: