I've 2 regular expression:
string regex1 = "(?i)(^(?!^.*?admin)(?!^.*?admin[admin\d]).*$)";
this will check for 'admin' substring in the given string and case is insensitive.string regex2 = "^[^<>?]{5,100}$";
this will check for special char(^<>?) and length between 5 to 100 only.
I want a regular expression where both the regex can be validated at once with the use of only single regex.
Ex-
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
ControlToValidate="txtBox1" ErrorMessage="Validation Failed!"
ValidationExpression="(?i)(^(?!^.*?admin)(?!^.*?admin[admin\d]).*$)">
</asp:RegularExpressionValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server"
ControlToValidate="txtBox2" ErrorMessage="Length Validation Failed!"
ValidationExpression="^[^<>?]{5,100}$">
</asp:RegularExpressionValidator>
Q. Can we have a single "RegularExpressionValidator" that serves both the above functionality?