输入框作业题

输入正浮点数的正则表达式:

 1     def regexpFunction(a)
 2         if a =~ /^[d]{0,9}*[1-9][0-9]*$/
 3             puts "OK"
 4             return a
 5         else
 6             puts "NOK"
 7             return 0
 8         end        
 9     end
10 
11     def regexpMatch(b)
12         puts "regexpMatch(0)"
13         return b.match(/^d*.d*$/)
14     end

 正则表达式在线生成网址:http://tool.lu/regex/

原文地址:https://www.cnblogs.com/liuyang92/p/5863332.html