KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
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 of two consecutive whitespace with a single space. However this does not actually work. Am I having a grave misunderstanding of regexes or the term "whitespace"?
Tags (comma-separated)
Save Edits
Cancel