[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

SV: st: Dropping not valid emails

From   <>
To   <>
Subject   SV: st: Dropping not valid emails
Date   Tue, 19 Feb 2008 13:13:38 +0100

Phil, that did the trick. Thanks a lot!

Best wishes,

-----Opprinnelig melding-----
Fra: [] På vegne av Phil Schumm
Sendt: 19. februar 2008 12:53
Emne: Re: st: Dropping not valid emails

On Feb 19, 2008, at 5:10 AM, wrote:
> I have a variable that contains e-mail adresses. I would like to find 
> a way to drop observations that does not contain valid email adresses.  
> There should be a condition that the string contains one '@', the 
> exsistence of period, and two or three characters following the 
> period, and no empty spaces.

This is best handled with a regular expression (i.e., with the -regexm
()- function).  For example, the following regular expression will match most valid email addresses:


Unfortunately, Stata's lack of support for curly braces (used to indicate bounds) means that you cannot use the following, shorter


which is essentially the same as the one above.  But the first one will work fine with -regexm()-.

-- Phil

*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index