title: How do I combine a regular expression function in vlookup?
body: <p>I have a VBA regular expression which I would like to combine with <code>VLOOKUP</code> however it does not return the value based on the regular expression if used with <code>VLOOKUP</code>.</p>
  
  <p>This is what it returns when I execution the function
  <code>=udfRegEx(A2,B2)</code></p>
  
  <p><strong>String</strong></p>
  
  <p>Microsoft Windows Server 2003, Standard Edition (64-bit)</p>
  
  <p><strong>Regular expression</strong></p>
  
  <p>^([^,]*)</p>
  
  <p><strong>Result</strong></p>
  
  <p>Microsoft Windows Server 2003</p>
  
  <p>However when I execute <code>=IFERROR(VLOOKUP(udfRegEx(A2,RegularExpression!B2),[Sample.xls]Sheet1!$B$2:$E$4177,4,FALSE),0)</code> it still returns Microsoft Windows Server 2003, Standard Edition (64-bit)</p>
  
  <p>Column B2 is the regular expression <code>^([^,]*)</code></p>