Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: RE: regular expressions in Stata


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: RE: regular expressions in Stata
Date   Tue, 13 Sep 2005 21:03:49 +0100

By the way, and putting on a hat as one of 
the Editors of the Stata Journal: we would 
like to carry something longer and expository 
in the Stata Journal on regular expressions, 
and at least one (person|cyborg) has 
expressed serious interest in writing that. 

Nick 
n.j.cox@durham.ac.uk 

scott hankins
 
> The "V" is there because I [...] tried to do two things
> at once. 
 
Nick Cox 

> > "76(4|5).3"
> > 
> > and
> > 
> > "^76(4|5).3"
> > 
> > both seem to work here. What's that "V" doing?

scott hankins

> > > I am trying to use the new regex functions and am having 
> some issues.
> > >
> > > I am familiar (but not an expert) with regular 
> expressions in Perl and
> > > I am problems applying that knowledge in Stata. Does 
> anyone know how
> > > regular expressions are implemented in Stata? Ideally, I 
> would like
> > > more than "Regular expression syntax is based on Henry 
> Spencer's NFA
> > > algorithm and as such, is nearly identical to the POSIX.2 
> standard."
> > > as I have not been able to find a clear exposition of the POSIX.2
> > > standard online (I am sure there is one, I just can't 
> find it :) ).
> > >
> > >
> > > ***********************************
> > > here is my problem
> > >
> > > pdx
> > > 76403
> > > 76403
> > > 76513
> > > 76503
> > >
> > >
> > > I tried the following code but it did not find any matches, this
> > > should find all 4 of the above occurrences.
> > >
> > > replace weight = 3 if regexm(pdx,"V76(4|5).3")
> > 
> > *
> > *   For searches and help try:
> > *   http://www.stata.com/support/faqs/res/findit.html
> > *   http://www.stata.com/support/statalist/faq
> > *   http://www.ats.ucla.edu/stat/stata/
> >
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
> 

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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