タグ

ブックマーク / pboyd.io (1)

  • The regex [,-.]

    I stumbled on this regex recently: \d{2}[,-.]\d{2}. The intention is clear enough: match two sets of two digits separated by a comma, a dash, or a period. Of course, it shouldn’t work. Dashes in character classes are special because they’re used for ranges (like [a-z] to match lower-case ASCII letters). If you want - in a character class you put it at the beginning, or the end, never the middle. S

    The regex [,-.]
    AKIMOTO
    AKIMOTO 2022/05/11
    偶然か達人か
  • 1