The Java API for regular expressions states that \s will match whitespace. So the regex \\s\\s should match two spaces. Pattern whitespace = Pattern.compile("\\s\\s"); matcher = whitespace.matcher(modLine); while (matcher.find()) matcher.replaceAll(" "); The aim of this is to replace all instances … Continue reading
The post Match Space in Regex Java appeared first on Solved.