Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | <X.Y.Vollenweider@lse.ac.uk> |
To | <statalist@hsphsun2.harvard.edu> |
Subject | st: RE : st: browse if regexm(make,".") |
Date | Tue, 29 Mar 2011 15:11:14 +0100 |
Thanks a lot all for your quick answers! Best, Xavier -------- Message d'origine-------- De: owner-statalist@hsphsun2.harvard.edu de la part de Neil Shephard Date: mar. 29/03/2011 15:00 À: statalist@hsphsun2.harvard.edu Objet : Re: st: browse if regexm(make,".") On Tue, Mar 29, 2011 at 2:54 PM, <X.Y.Vollenweider@lse.ac.uk> wrote: > Dear Statalisters, > > Actually, I have this problem as well: > > **** > sysuse auto > browse if regexm(make,"A")==1 // it lists all string variables with a "A" > browse if regexm(make,".")==1 // it lists everything instead of just the obs with a dot(".") > **** > Thats because you don't know how to write regular expressions. In most regular expressions the literal '.' is a wild card for "anything", you want to escape it like... browse if regexm(make,"\.") (and you don't need the '==1' qualifier). See more on regular expressions at https://secure.wikimedia.org/wikipedia/en/wiki/Regular_expression and note that Stata's implementation is POSIX 2 compliant as stated in -man regexm()- Neil -- "Truth in science can be defined as the working hypothesis best suited to open the way to the next better one." - Konrad Lorenz Email - nshephard@gmail.com Website - http://kimura.no-ip.org/ Photos - http://www.flickr.com/photos/slackline/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ Please access the attached hyperlink for an important electronic communications disclaimer: http://lse.ac.uk/emailDisclaimer
<<winmail.dat>>