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.
受け入れる正規表現を作成しようとしています
整数
123
また
整数、アンダースコア、別の整数
123_45
これが私が持っているものです
/^[0-9]+_*[0-9]*$/
_*[0-9]*(2 番目の部分) をオプションにする方法
_*[0-9]*
この正規表現を使用します^\d+(_\d+)?$
^\d+(_\d+)?$
この式を確認してください。
/ ^ [0-9] +(_([0-9])+)?$ /
123_とは一致しません