I try to get at least three words separated by two commas. I managed to combine two words with one comma using
/([A-z]|[0-9])(,{1})([A-z]|[0-9])/
but how can I add a comma and a word to it. I tried to repeat the same, but did not work.
/^(?:\w+,){2,}(?:\w+)$/
This will give you a comma-separated list of at least 3 words ([a-zA-Z0-9 _] +).
/^\s*(?:\w+\s*,\s*){2,}(?:\w+\s*)$/
This is a slightly more convenient version of the first, allowing spaces between words.
PERL , , , /[^,]+(?:,[^,]+){2,}/ , , , - . (?:) . {2,} 2 . javascript :
/[^,]+(?:,[^,]+){2,}/
(?:)
{2,}
/[^,]+(?:,[^,]+){2,}/.test("hello,world,whats,up,next"); // returns true /[^,]+(?:,[^,]+){2,}/.test("hello,world"); // returns false
:
Try the following:
([a-zA-Z0-9]+)(,[a-zA-Z0-9]+){2,}
This will solve your problem, try this.
([A-Za-Z0-9], [A-Za-Z0-9], ([A-Za-Z0-9]))