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

st: regular expressions in Stata


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

Hello

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")
***********************************

thanks in advance

scott

*
*   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