Option
Explicit
Public
Sub
suchen_und_kopieren()
Dim
strSQL
As
String
strSQL = get_sql_string
Dim
regEx
As
New
RegExp
With
regEx
.Global =
True
.IgnoreCase =
False
.MultiLine =
True
.Pattern =
"PPD(?!_)[A-Z;a-z;0-9]+"
End
With
Dim
colMatches
As
MatchCollection
Dim
m
As
Match
Set
colMatches = regEx.Execute(strSQL)
If
colMatches.Count = 0
Then
GoTo
clean_up
End
If
Dim
l
As
Long
For
Each
m
In
colMatches
With
Worksheets(
"Tabelle2"
)
l = .Cells(.Rows.Count, 1).
End
(xlUp).Row + 1
.Cells(l, 1) = m.FirstIndex
.Cells(l, 2) = Right(m.Value, 10)
End
With
Next
m
clean_up:
If
Not
colMatches
Is
Nothing
Then
Set
colMatches =
Nothing
If
Not
regEx
Is
Nothing
Then
Set
regEx =
Nothing
End
Sub