Untitled
unknown
vbscript
a year ago
666 B
7
Indexable
Function ExtractPart(str As String) As String
Dim regex As Object
Dim matches As Object
Dim match As Object
' Create the regex object
Set regex = CreateObject("VBScript.RegExp")
' Set the regex pattern to find AU-xxxxxx-x format
regex.Pattern = "AU-\d+-\d"
regex.Global = True
' Find matches
Set matches = regex.Execute(str)
' Check if there is at least one match
If matches.Count > 0 Then
' Return the first match
ExtractPart = matches(0).Value
Else
' Return an empty string if no match is found
ExtractPart = ""
End If
End Function
Editor is loading...
Leave a Comment