Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library
← Back to context

Comment by annex-winged-cr

3 days ago

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

2 comments

annex-winged-cr

Reply

chii  3 days ago

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  3 days ago

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

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities