PDA

View Full Version : regular expression to extract 10 digit number



c19h28O2
08-07-2006, 01:55 AM
Hi,I'm wondering how to use a regular expression to find a 10 digit number in any email, i.e. a new email arrives, and a sub or function searches the email for a 10 digit number and holds it in a variable.... any ideas?Cheers

c19h28O2
08-07-2006, 01:59 AM
Guys,I've got this [/code]Sub ValidFileName() Dim RegEx As Object Dim number As Long number = 123456789 Dim valid As Boolean Set RegEx = CreateObject("vbscript.regexp") RegEx.Pattern = "\d{10}" valid = RegEx.test(number) Set RegEx = NothingEnd Sub[code]i just need to use a find method to run through the emails?