Reputation: 739
I have a string
K9908098F, G2342D34324/ 234234323, 234-234-234; R324234
How to catch only 234234323
and 234-234-234
in VBA?
This [\d-]+
pattern grabs extra pieces
Upvotes: 1
Views: 1217
Reputation: 1436
Not too elegant though but would work. Just a small addition to your regex.
[\d-]+[,;]
Upvotes: 0
Reputation: 7627
Give this a try:
This will capture 234234323
in group 1 and 234-234-234
in group 2.
Upvotes: 0