I am trying to remove dtd tag from all the xml documents in a directory and I am trying to remove it using regex.
The following expression I am using to remove it.
<!DOCTYPE[^>[]*(\[[^]]*\])?>
But, I am getting the below error
java.util.regex.PatternSyntaxException: Unclosed character class near index 27
<!DOCTYPE[^>[]*(\[[^]]*\])?>
^
Could someone let me know the Java equivalent regex for the above string.