﻿Private Sub splitUpRegexPattern()
    Dim regEx As New RegExp
    Dim strPattern As String
    Dim strInput As String
    Dim strReplace As String
    Dim Myrange As Range

    Set Myrange = ActiveSheet.Range("A1:A3")

    For Each C In Myrange
        strPattern = "(^[0-9]{3})([a-zA-Z])([0-9]{4})"

        If strPattern <> "" Then
            strInput = C.Value
            strReplace = "$1"

            With regEx
                .Global = True
                .MultiLine = True
                .IgnoreCase = False
                .Pattern = strPattern
            End With

            If regEx.test(strInput) Then
                C.Offset(0, 1) = regEx.Replace(strInput, "$1")
                C.Offset(0, 2) = regEx.Replace(strInput, "$2")
                C.Offset(0, 3) = regEx.Replace(strInput, "$3")
            Else
                C.Offset(0, 1) = "(Not matched)"
            End If
        End If
    Next
End Sub

'Order  Name                Representation
'1      Parentheses         ( )
'2      Multipliers         ? + * {m,n} {m, n}?
'3      Sequence & Anchors  abc ^ $
'4      Alternation         |
'
'Predefined Character Abbreviations:
'
'abr    same as       meaning
'\d     [0-9]         Any single digit
'\D     [^0-9]        Any single character that's not a digit
'\w     [a-zA-Z0-9_]  Any word character
'\W     [^a-zA-Z0-9_] Any non-word character
'\s     [ \r\t\n\f]   Any space character
'\S     [^ \r\t\n\f]  Any non-space character
'\n     [\n]          New line

