suyar 2019-07-09 16:12:05

匹配正整數 小數 (0|([1-9]+\d*))\.\d+|[1-9]+|0

var pattern = /(0|([1-9]+\d*))\.\d+|[1-9]+|0/g,
	str = '';
console.log(pattern.test(str));

-- 以下是正確的
0
0.1
1.1

-- 以下是錯誤的
0000
00.1
001.1
1.

评论

trang chủ - Wiki
Copyright © 2011-2024 iteam. Current version is 2.137.3. UTC+08:00, 2024-11-28 15:42
浙ICP备14020137号-1 $bản đồ khách truy cập$