I am facing a very weird issue with regex in my confiform. I am a beginner of Regex.
I have a text field in my confiform where I have put a rule below in the field definition's validation field itself to accept only two email ids and below is the rule which works fine and block if more than two email ids are entered:
^(?=[^@]*(?:@[^@]*){0,2}$).*$
In addition I was asked to enter a rule on the same field that only certain domains should be allowed so I inserted a new validation rule macro on this field separately within the form with below to say that apart from these two domains don't allow anything else:
^.+?(@abc.com|@xyz.com)$
Both of them works independently well but when I have both rules in place(one within the field definition and one as a separate rule definition macro)below is happening:
1. When some one enters some other domain(apart from the two I have configured) and three email ids, the error shows first is the one to say that there are more than two email ids and once I removed the third email id, the domain rule doesn't work
2. If I have only two email ids and if one of them is external domain then domain rule works and throws error stating there is an external domain as expected
Kindly help me on how I can combine and get both of them worked fine