我需要以正则表达式格式指定字符串 find,以便可以找到 head 标签,无论其格式是<html >
or<html>
还是< html>
。如何指定正则表达式格式的查找字符串?
String source = "<html >The quick brown fox jumps over the brown lazy dog.</html >";
String find = "<html>";
String replace = "";
Pattern pattern = Pattern.compile(find);
Matcher matcher = pattern.matcher(source);
String output = matcher.replaceAll(replace);
System.out.println("Source = " + source);
System.out.println("Output = " + output);