1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
Sub test_regexp(chaine As String)
Dim reg As VBScript_RegExp_55.regexp
Dim Match As VBScript_RegExp_55.Match
Dim Matches As VBScript_RegExp_55.MatchCollection
' - instanciation
Set reg = New VBScript_RegExp_55.regexp
'- application sur toutes les occurences
reg.Global = True
' - on ignore la casse
reg.IgnoreCase = True
' - le motif
reg.Pattern = "c\s\d+y\b"
'- la recherche
Set Matches = reg.Execute(chaine)
' - les occurences trouvées
For Each Match In Matches
Debug.Print Right(Match.Value, Match.Length - 2)
Next Match
End Sub
Sub main()
test_regexp "30y nc 5y s/s 81+/87"
End Sub |
Partager