Hi, everyone. I have the data including number and letter as following
"1 reviews 2 hotel reviews 3 helpful votes"
"5 re 7 hotel 6 helpful vote"
"11 reviews 2 hotel s 3 helpful votes"
I want to extract the number as sperate three columns
case1 case2 case3
1 2 3
5 7 6
11 2 3
I extract the first column as following
How could I do it using regular expressions? Any suggestions much appreciate.
Bests,
wanhaiyou
"1 reviews 2 hotel reviews 3 helpful votes"
"5 re 7 hotel 6 helpful vote"
"11 reviews 2 hotel s 3 helpful votes"
I want to extract the number as sperate three columns
case1 case2 case3
1 2 3
5 7 6
11 2 3
I extract the first column as following
Code:
clear input str60 case "1 reviews 2 hotel reviews 3 helpful votes" "5 re 7 hotel 6 helpful vote" "11 reviews 2 hotel s 3 helpful votes" end gen zip1 = regexs(0) if regexm(case, "^[0-9]+")
How could I do it using regular expressions? Any suggestions much appreciate.
Bests,
wanhaiyou
Comment