> I've tried, but the only way to make it work, seems to be to use replaceAll
> with the whole line as first argument. Is there a way to work with regex
> like e.g. "<!DOCTYPE *>" ? I've been trying lots of things, but they don't
> seem to work.
Try "<!DOCTYPE [^>]*>". The pattern you gave only matches DOCTYPE
followed by spaces and a '>', but your real document contains other
characters after DOCTYPE and before the '>'.

Signature
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
Tim De Roeck - 23 May 2004 07:03 GMT
>> I've tried, but the only way to make it work, seems to be to use
>> replaceAll with the whole line as first argument. Is there a way to
[quoted text clipped - 4 lines]
> followed by spaces and a '>', but your real document contains other
> characters after DOCTYPE and before the '>'.
Do you have a link where there's more information on how to form these
regular expressions? Because it seems that "?" has it's own meaning in a
regex in java too. (I'm trying to change other things too) Thanx for the
help!
Tim
Andrew Thompson - 23 May 2004 07:33 GMT
> Do you have a link where there's more information on how to form these
> regular expressions?
Some info is hidden here..
<http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html#sum>
HTH

Signature
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Tim De Roeck - 23 May 2004 12:51 GMT
><http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html#sum>
thanx, I found this one that helped me along too. ;-)
<?xml version="1.0" encoding="UTF-8"?>
http://mindprod.com/jgloss/regex.html
greetz
Tim
Thomas Schodt - 23 May 2004 07:22 GMT
> Try "<!DOCTYPE [^>]*>". The pattern you gave only matches DOCTYPE
> followed by spaces and a '>', but your real document contains other
> characters after DOCTYPE and before the '>'.
Or maybe "(?s)<!DOCTYPE .*?>".
(?s) treat newline as any other character
. match any character
*? as few as possible ("reluctant" quantifier)