Got more questions? Find advice on: ASP | SQL | XML | Windows
in Search
Welcome to RegexAdvice Sign in | Join | Help

Find first emila address in a CV

Last post 09-10-2008, 9:36 AM by Ribeyed. 0 replies.
Sort Posts: Previous Next
  •  09-10-2008, 9:36 AM 46191

    Find first emila address in a CV

    Hi All,

     

    I need a regex that matches the first email address found in a string of text imported from a person’s curriculum vitae.

     

    I found the example bellow for retrieving an RFC 2822 email address.

     

    ((?<user>(?:(?:[^ \t\(\)\<\>@,;\:\\\"\.\[\]\r\n]+)|(?:\"(?:(?:[^\"\\\r\n])|(?:\\.))*\"))(?:\.(?:(?:[^ \t\(\)\<\>@,;\:\\\"\.\[\]\r\n]+)|(?:\"(?:(?:[^\"\\\r\n])|(?:\\.))*\")))*)@(?<domain>(?:(?:[^ \t\(\)\<\>@,;\:\\\"\.\[\]\r\n]+)|(?:\[(?:(?:[^\[\]\\\r\n])|(?:\\.))*\]))(?:\.(?:(?:[^ \t\(\)\<\>@,;\:\\\"\.\[\]\r\n]+)|(?:\[(?:(?:[^\[\]\\\r\n])|(?:\\.))*\])))*))

     

    This works fine, it finds all email address however I would like to only return the first email address found.

     

    How do I change the above regex to only find the first email address?

     

    Thanks in advance for any help received.

     

    David

View as RSS news feed in XML