I'm trying to create regex for multiple strings separated by comma or space.
Lorem Ipsum // valid
Lorem, Ipsum //valid
Lorem, Ipsum, Ipsum, Ipsum // multiple valid
Lorem // invalid without space/comma
Here is what i have so far:
^\w+(,\s*\w+){3}$/
Lorem,Ipsum? Also, isLorem ,Ipsumvalid? On that note, areLorem, , Ipsum,Lorem,, IpsumorLorem Ipsumvalid? Basically, what are your exact requirements/conditions?\w+(?:[, ]+\w+)+?^\w+(?:(?:,\s\w+)+|(?:\s\w+)+)$- it will match a string that starts with 1+ word chars, and then has 1 or more repetitions of,followed with a whitespace and 1+ word chars or 1+ repetitions of a space followed with 1+ word chars. Another way of writing it is^\w+(?=(,?\s))(?:\1\w+)+$