I'm trying to use regular expessions to strip out multi-line html comments. The following is an example of what I'm trying to do:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1DTD/xhtml1-transitional.dtd">
The way I'm trying to match this is: Pattern comments = Pattern.compile("<!.*?|[\n]*?>", Pattern.MULTILINE);
But this only gets the opening <! and the end > as two separate groups. I haven't had luck returning the whole pattern as a single group (so I can easily delete it). Can someone explain to me how to fix this?