logoalt Hacker News

annex-winged-cr • today at 12:28 PM • 2 replies • view on HN

TIL about [^], never seen that before. Apparently, it works like a dot but it also matches newlines.


Replies

chii • today at 2:04 PM

I believe this is the regular syntax for a set of characters (between "[" and "]"), but the caret symbol ("^") is negation when used inside the set. Therefore, it is simply the negation of an empty set of characters.

gmac • today at 12:50 PM

Oh, me too. I’ve previously used [\s\S] for that.