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

Re: st: RE: regular expressions in Stata


From   scott hankins <[email protected]>
To   [email protected]
Subject   Re: st: RE: regular expressions in Stata
Date   Tue, 13 Sep 2005 13:54:58 -0400

The "V" is there because I am an idiot :) and tried to do two things
at once. Thanks for taking time to help.

scott

p.s. thanks as well for all of your effort with this list, I have
learned a lot from you in the last couple of years.


On 9/13/05, Nick Cox <[email protected]> wrote:
> "76(4|5).3"
> 
> and
> 
> "^76(4|5).3"
> 
> both seem to work here. What's that "V" doing?
> 
> Nick
> [email protected]
> 
> 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/



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