RegEx for CSV validation + jQuery

后端 未结 2 970
闹比i
闹比i 2021-01-17 04:52

Using jQuery validation plugin but it has no CSV validation. I have made an additional validation for this but can\'t get the RegEx right.

Here is what I have:

2条回答
  •  鱼传尺愫
    2021-01-17 05:50

    Building on Chad's example, just switch [^,] to \w if you want only word characters. If you actually want just letters and digits, you'll need something like [a-z0-9] as \w includes the underscore character.

    Based on your comment, see if

    /^([a-z0-9])+(,[a-z0-9]+)*$/
    

    does the trick.

提交回复
热议问题