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

st: RE: regular expressions in Stata


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: regular expressions in Stata
Date   Tue, 13 Sep 2005 18:44:46 +0100

"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/



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