in reply to How to match a string containing whitespace characters
I believe regexp 3, with single backslashes doesn't work because it is looking for an actual whitespace character
Correct. See "Escape sequences" in perlre.
I think regexp 5 fails for the same reasons regexp No 3 fails
Correct.
My 'character class' regexp 2, doesn't work. It matches on a plain 'r'.
[\\r,\\n,\\t,\\f] will match a single character from the following six: backslash (\), comma (,), "r", "n", "t" and "f". See Using character classes in perlretut.
Is there [...] a more succint way of expressing the regexp?
From /\\r|\\n|\\t|\\f/, we can factor out the slash:
/\\(?:r|n|t|f)/
And since we are choosing between single characters, we can replace the alternation with a character class:
/\\[rntf]/
|
|---|