I want to match all expressions with exactly one whitespace. Currently, I\'m using [^\\\\s]*\\\\s[^\\\\s]*. That doesn\'t seem like a very good way, though.
Use transliterate. It has to be an independent test, the regex you have above cannot be combined with a larger regex and still test for a single whitespace.
Transliterate is 10-20 times faster than a regex for this test.
This is a jtr example:
String aInput = "This is a test, 123.";
CharacterReplacer cReplacer = Perl5Parser.makeReplacer( "tr[ \\t\\r\\n\\f\\x0B][ \\t\\r\\n\\f\\x0B]" );
String aResult = cReplacer.doReplacement( aInput );
int nMatches = cReplacer.getMatches();
if (nMatches == 1) { ... }