I found regular expression of Stata very confusing. For instance:
Code:
disp regexm("010-11223344","\d{3}-\d{8}")
Stata return 0 for the evaluation, then I modified re as:
Code:
disp regexm("010-11223344","[0-9]{3}-[0-9]{8}")
Stata still told me 0 result. Finally, I rewrote:
Code:
disp("010-11223344","[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]")
and Stata return 1.
I really felt it silly the way writing regular expression in Stata. It will be a catastrophe when we encounter a more complex one.