Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Regular Expression taking a long time if string is over 30 chars.

Status
Not open for further replies.

wadey

Programmer
Jun 6, 2006
54
GB
My regular expression is hanging for 5 extra seconds per character for each character that is added to the string, when the string exceeds 30 characters in length.

The regular expression checks for correct email addresses.
the following example has 33 chars and hangs for about 20 seconds. Try adding more chars and see what happens.

here is the code:-

Dim regEx As RegExp
Set regEx = New RegExp
regEx.IgnoreCase = True

regEx.Pattern = "^([a-z0-9_\-\.]+)*[a-z0-9]@[a-z][\w\.-]*[a-z0-9]\.[a-z][a-z\.]*[a-z]$"

regEx.Test("veryverylongemailaddress@work.com")


Why ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top