Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
つまり、「2桁または4桁のいずれかのみに一致する」ということです。タイトルの表現は問題なく機能しますが、正規表現を学んでいるだけなので、私が知らない演算子を使用してよりきれいに見える方法があるかどうか疑問に思っています。
はい、別の形で書き直しました。いいえ。
せいぜいこれができる
(\d{2}|\d{4})