我正在为我的<input type="tel" />使用模式属性,并且我在使用正则表达式时遇到了困难。我尝试了pattern="d{10]"和pattern="d{3}[\)]\d{3}[\-]\d{4}",但它不起作用。
发布于 2013-02-01 23:36:19
改用下面的代码:
pattern="\(\d{3}\) \d{3}-\d{4}"这就是问题所在:http://jsfiddle.net/ZMaXA/
尝试处理input中的值。
发布于 2013-02-01 23:45:40
Python 2.7.3 (default, Aug 1 2012, 05:14:39)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> str='(777) 777-9087'
>>> r=re.search('\(([^\)]+)\)\s*(\d+-\d+)',str)
>>> r.groups()
('777', '777-9087')https://stackoverflow.com/questions/14649713
复制相似问题