trouble finding the pattern

Results 1 to 3 of 3

Thread: trouble finding the pattern

  1. #1
    Join Date
    Dec 1969

    Default trouble finding the pattern

    Hi,<BR>I&#039;m wonding what is the problem here. I&#039;m trying to use regular expressions to find an email address that is embedded in a string (as in the header of a bounced email). Here, the address in my example is, but it has an extra letter at the end in the string. I want to be able to still pick out an email with a pattern, so I tried the following:<BR><BR> Dim re<BR> Set re = new RegExp<BR>re.IgnoreCase = False<BR> re.Global = false<BR> str="joe@byeday.coms"<BR> <BR> <BR> re.pattern = "^w+@[a-zA-Z_]+?.[a-zA-Z]{3}$"<BR> <BR>Set Matches = re.Execute(str)<BR><BR>For Each Item in Matches<BR> Response.Write Item.Value<BR>Next<BR><BR>This produces no results.<BR><BR>The problem is it can&#039;t recognize the email address. Is there something I&#039;m doing wrong in the pattern? Thanks for your help.

  2. #2
    Arjan Guest

    Default RE: trouble finding the pattern

    I used [w&#124.]*@[^.]*.[w]*<BR><BR>maybe something for you?<BR>Or there are ideas in it you could use?<BR><BR>Arjan,<BR>netherlands

  3. #3
    Join Date
    Dec 1969

    Default RE: trouble finding the pattern

    This is the reg exp i&#039;ve used. it seems to work very well. its very flexible to allow for new domains with more than 3 letters.<BR><BR>"^w+((-w+)&#124(.w+))*@w+((.&#124-)w+)*.w+$"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts