title: Can I "combine" 2 regex with a logic or?
body: <p>I need to validate Textbox input as credit card number. I already have regex for different credit cards:</p>
  
  <ul>
  <li>Visa: <code>^4[0-9]{12}(?:[0-9]{3})?$</code></li>
  <li>Mastercard: <code>^([51|52|53|54|55]{2})([0-9]{14})$</code></li>
  <li>American Express: <code>^3[47][0-9]{13}$</code></li>
  </ul>
  
  <p>and many others. </p>
  
  <p>The problem is, I want to validate using different regex based on different users. For example: For user1, Visa and Mastercard are available, while for user2, Visa and American Express are available. So I would like to generate a final regex string dynamically, combining one or more regex string above, like:</p>
  
  <pre><code>user1Regex = Visa regex + "||" + Mastercard regex
  
  user2Regex = Visa regex + "||" + American Express regex
  </code></pre>
  
  <p>Is there a way to do that? Thanks,</p>