0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

正規表現で数値かを判定

Last updated at Posted at 2025-06-07

正の整数かを判定する正規表現

^[0-9]+$
マッチする文字列:12345
マッチしない文字列:12345円、12.345

小数点を含む正の整数かを判定する正規表現

^\d+.\d+$
マッチする文字列:12345、12.345
マッチしない文字列:$12.345

以上です。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?