I\'m trying to construct an email form that takes multiple comma separated emails as an input and verifies them using HTML5. I want to use the following regex to sanity check t
Is there a way to mix pattern and multiple so the regex checks each item in the comma separated list?
Yes. If the regex to match an element is foo, then
^(?:foo(?:,(?!$)|$))*$
will match a comma separated list of foos.
The separator is (?:,(?!$)|$) which will match either a required comma that does not end the input, or the end of input.
That separator is horribly ugly, but allows you to avoid duplicating the "foo" as long as no suffix of the separator is a required non-empty prefix of the body.