Hello,
I have looked around online extensively and found some solutions that seem to work on regextester, but when I apply them to STATA my code does not work.
I would like to find observations from a string that contain the words "Single" or "single" but I would like regexm to ignore the observation if "malt" or "Malt" is also included in the string
STATA returns the error: regexp: ?+* follows nothing
Other threads containing this error code discuss escaped characters, but this is not what I believe I wish to achieve.
Has anyone got any pointers? Thanks.
STATA 15.0
I have looked around online extensively and found some solutions that seem to work on regextester, but when I apply them to STATA my code does not work.
I would like to find observations from a string that contain the words "Single" or "single" but I would like regexm to ignore the observation if "malt" or "Malt" is also included in the string
Code:
gen byte c_singlecask = regexm(name, "(?!.*(alt)).*ingle")==1
Other threads containing this error code discuss escaped characters, but this is not what I believe I wish to achieve.
Has anyone got any pointers? Thanks.
STATA 15.0
Comment