Regex Pattern
^\s+|\s+$|(\s)\s+
Replacement
$1
Description This regex pattern performs multi-purpose whitespace normalization by:
^\s+
)\s+$
)(\s)\s+ → \1
)
The replacement \1 preserves the first captured whitespace character while eliminating redundant ones, ensuring clean, standardized spacing.