Whenever I perform a regex match via say
, the log will spit out bad regex error for every single bad item, which for large datasets fills the console and the entire log with useless information, rendering the console useless because it exceeds the scroll buffer, and making the log painfully large and difficult to parse.
Here is a simple example:
This will generate a stream of regexp: unterminated () errors in red. In nearly every case, this is unessessary and only one error would be sufficient to alert the user to the il-formed regex.
Is there an obvious way to supress this error? The regexm() function appread to be a built-in function, so I don't think the function can either be edited and then ghosted as a personal function.
I also don't quite know how one would put a wrapper around the function to supress the errors. One could capture the generate function, but the errors spit out by regexm() don't appear to insert themselves into _rc, so I have no way of knowing if it failed. It would also be nice to have a wrapper for the function itself so that one doesn't need to write a new generate function.
Code:
gen var2 = regexm(var1,"(stuff")
Here is a simple example:
Code:
clear sysuse auto gen ford = regexm(make, "(Ford|Linc|Merc")
Is there an obvious way to supress this error? The regexm() function appread to be a built-in function, so I don't think the function can either be edited and then ghosted as a personal function.
I also don't quite know how one would put a wrapper around the function to supress the errors. One could capture the generate function, but the errors spit out by regexm() don't appear to insert themselves into _rc, so I have no way of knowing if it failed. It would also be nice to have a wrapper for the function itself so that one doesn't need to write a new generate function.
Comment