Community Patterns

Community Library Entry

2

Regular Expression
Created·2021-07-13 10:31
Flavor·PCRE2 (PHP)

/
\s(?=[\s":{}])
/
g
Open regex in editor

Description

I use it so that I don't need to worry about formatting when working with unit tests in Kotlin, which means I don't worry too much about whether this is production quality, but it could be useful in other situations where the desire is to strip whitespace from a JSON object while protecting the values of stings which have whitespace.

Submitted by anonymous