Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: regex-syntax error: "regexp: unmatched []"; no possibility to stop the do-file


From   Inna Becher <[email protected]>
To   [email protected]
Subject   st: regex-syntax error: "regexp: unmatched []"; no possibility to stop the do-file
Date   Mon, 26 Jan 2009 16:30:46 +0100

Dear stata-listers,
I have a problem with stata-regular expressions. Here is an example:

/*--- example ---*/
preserve
clear
set obs 5

gen v1=.

replace v1=1 if regexm(v1,"[]")==1
display _rc

restore
/*--- end example ---*/

The regex-command returns the return code "0", but there are  several
red  error  messages  because  of  the  regex-syntax  error  "regexp:
unmatched []".
Since our  real data  has about  30mio. observations  and the  syntax
error message is printed out for  every single observation, we  would
like to stop  the  regex   command with  the  first  "error"  message
"regexp: unmatched []". Since there is no useful return code (in fact
there is  the  return  code 0  after complete  execution of the regex
command),   we would like  to  know  how  to kill the  command  after
the  first  occurence of  "regexp:  unmatched []" automatically.

There is  even no  chance of  stopping the  program by  pressing  the
break button after a "more"-condition.

Is there a way to stop the execution after the first occurence of the regex error message "regexp: unmatched []"?


Thanks in advance for your help,

Inna Becher





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



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