I have a multiline HTML document that I am trying to get some stuff from. I\'m using java\'s regex (I know - XML parsers bla bla bla, just bear with me here please :) ).
Attach (?s)
to the front of your pattern :
input = input.replaceAll("(?s)<object classid=\"java:com\\.sun\\.java\\.help\\.impl\\.JHSecondaryViewer.*?object>", "buh bye!");
From the Javadoc:
Dotall mode can also be enabled via the embedded flag expression
(?s)
. (Thes
is a mnemonic for "single-line" mode, which is what this is called in Perl.)
Other flags work this way as well
Special constructs (non-capturing)
...
(?idmsux-idmsux)
Nothing, but turns match flags i d m s u x on - off
On a side note, if your goal is to remove unsafe objects from HTML from an untrusted source, please don't use regular expressions, and please don't blacklist tags.