title: Excel VBA Regex Check For Repeated Strings
body: <p>I have some user input that I want to validate for correctness. The user should input 1 or more sets of characters, separated by commas.</p>
  
  <p>So these are valid input</p>
  
  <ul>
  <li>COM1</li>
  <li>COM1,COM2,1234</li>
  </ul>
  
  <p>these are invalid</p>
  
  <ul>
  <li>COM -- only 3 characters</li>
  <li>COM1,123 -- one set is only 3 characters</li>
  <li>COM1.1234,abcd -- a dot separator not comma</li>
  </ul>
  
  <p>I googled for a regex pattern to this and found a possible pattern that tested for a recurring instance of any 3 characters, and I modified like so</p>
  
  <p>/^(.{4,}).*\1$/</p>
  
  <p>but this is not finding matches.</p>
  
  <p>I can manage the last comma that may or may not be there before passing to the test so that it is always there.</p>
  
  <p>Preferably, I would like to test for letters (any case) and numbers only, but I can live with any characters.</p>
  
  <p>I know I could easily do this in straight VBA splitting the input on a comma delimiter and looping through each character of each array element, but regex seems more efficient, and I will have more cases than have slightly different patterns, so parameterising the regex for that would be better design.</p>
  
  <p>TIA</p>