in reply to Question regarding a regex

No, the caret only negates the character set if it appears immediately after the left square bracket. Outside square brackets, it matches the beginning of the string or immediately after a newline. Also: the  -~ sequence inside square brackets means 'any character between space and tilde, inclusive.'

So in words, the regular expression specifies 'all characters in the first 4096 (or end-of-file, whichever comes first) are "\r", "\n", "\t", or characters in the range space to tilde, inclusive, in your machine's native encoding'.

Off-topic comments:

Replies are listed 'Best First'.
Re^2: Question regarding a regex
by AnomalousMonk (Archbishop) on Jul 23, 2021 at 00:05 UTC
    Outside square brackets, it [caret] matches the beginning of the string or immediately after a newline.

    By default, ^ (caret) outside a character class matches only at the beginning of a string, exactly as \A does. Caret (outside a character class) also matches immediately after an embedded newline if the /m modifier is asserted. See Modifiers in perlre.


    Give a man a fish:  <%-{-{-{-<