Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
<<winmail.dat>>
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: RE : st: browse if regexm(make,".")
From
<[email protected]>
To
<[email protected]>
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: [email protected] de la part de Neil Shephard
Date: mar. 29/03/2011 15:00
À: [email protected]
Objet : Re: st: browse if regexm(make,".")
On Tue, Mar 29, 2011 at 2:54 PM, <[email protected]> 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 - [email protected]
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