请问一个正则表达式写法: 1,33,44,112,2 , 如何写都不对, 似乎也不简单! 各位大侠 !

WBOY
Release: 2016-06-13 12:53:31
Original
906 people have browsed it

请教一个正则表达式写法: 1,33,44,112,2 , 怎么写都不对, 似乎也不简单! 求助各位大侠 !!!

本帖最后由 vencie 于 2013-02-22 21:02:30 编辑 请教一个正则表达式写法:    1,33,44,112,2

也就是逗号分隔的数字.

有2个要求:
1.  首尾不能有逗号
2.  中间的逗号不能连续出现2次.


自己很菜,  尝试了这样的写法, 但不可行:
^[0-9]*{[,]?[0-9]*}*$"

求助 !
正则表达式
------解决方案--------------------
/^(\d+,){1,}\d+$/
------解决方案--------------------
这样写
/^(?:\d+,)*\d+$/
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!