Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: browse if regexm(make,".")
From
Neil Shephard <[email protected]>
To
[email protected]
Subject
Re: st: browse if regexm(make,".")
Date
Tue, 29 Mar 2011 15:00:13 +0100
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/