Advertisement
Igorlegor

Function RegExCheck

Feb 19th, 2025
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Function RegExCheck(pattern As String, targetCell As Range) As Boolean
  2.     Dim regEx As Object
  3.     Set regEx = CreateObject("VBScript.RegExp")
  4.    
  5.     ' Configure RegExp
  6.    regEx.pattern = pattern
  7.     regEx.IgnoreCase = False ' Set to True if case-insensitive matching is needed
  8.    regEx.Global = False ' Only check for the first match
  9.    
  10.     ' Perform the match and return result
  11.    RegExCheck = regEx.Test(targetCell.Value)
  12. End Function
  13.  
  14.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement