Hello All,
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:
jQuery.validator.addMethod("csv", function(value, element) {
return this.optional(element) || /([\w.$]+?(,[\w.]+)+)/.test(value);
}, "Must be comma separated if entering multiple values: value1,value2");
Any thoughts for the RegEx?
([\w.$]+?(,[\w.]+)+)
What I'm trying to do is have the user enter in a value, which can be a single value or multiple values in CSV format.
Example 1: value1
Example 2: value1,value2,etc... no limit