[英]Regex: number and comma alternation between double quotes
I need to create a regex that matches a "1,2,3,10,12312"
pattern.我需要创建一个匹配
"1,2,3,10,12312"
模式的正则表达式。
As I understand it would start with /([""'])
to match the double quotes but I'm lost when I try to get to the \\d digit and comma alternation.据我所知,它会以
/([""'])
开头来匹配双引号,但是当我尝试使用 \\d 数字和逗号交替时,我迷路了。
what would be a valid regex to do that?什么是有效的正则表达式来做到这一点?
You have some choices, one being:您有一些选择,其中之一是:
"\d+(?:,\d+)*"
To even allow empty double quotes ( ""
), change the expression to要甚至允许空双引号 (
""
),请将表达式更改为
"\d*(?:,\d+)*"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.