explain whitespace pattern
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1407537 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fa4ed70023
commit
8a946932c8
|
@ -150,6 +150,11 @@ public class StringUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A regex pattern for recognizing blocks of whitespace characters.
|
* A regex pattern for recognizing blocks of whitespace characters.
|
||||||
|
* The apparent convolutedness of the pattern serves the purpose of
|
||||||
|
* ignoring "blocks" consisting of only a single space: the pattern
|
||||||
|
* is used only to normalize whitespace, condensing "blocks" down to a
|
||||||
|
* single space, thus matching the same would likely cause a great
|
||||||
|
* many noop replacements.
|
||||||
*/
|
*/
|
||||||
private static final Pattern WHITESPACE_PATTERN = Pattern.compile("(?: \\s|[\\s&&[^ ]])\\s*");
|
private static final Pattern WHITESPACE_PATTERN = Pattern.compile("(?: \\s|[\\s&&[^ ]])\\s*");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue