Skip to content

Instantly share code, notes, and snippets.

@OlegBezverhii
Created September 28, 2020 11:38
Show Gist options
  • Save OlegBezverhii/7019f125e053699a83d05b0248157911 to your computer and use it in GitHub Desktop.
Save OlegBezverhii/7019f125e053699a83d05b0248157911 to your computer and use it in GitHub Desktop.
Регулярные выражения для Excel для приведение типа томов архива Транснефть к нормальному виду
Public Function RegExpExtract(Text As String, Optional Item As Integer = 1) As String
On Error GoTo ErrHandl
Set regex = CreateObject("VBScript.RegExp")
regex.Pattern = "Г\.0\.0000\.0002-И-ЦУП ВСТО\/ГТП-27\.\d\d\d\-.{1,4}"
regex.Global = True
If regex.Test(Text) Then
Set matches = regex.Execute(Text)
RegExpExtract = matches.Item(Item - 1)
Exit Function
End If
ErrHandl:
RegExpExtract = CVErr(xlErrValue)
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment