I am working on cleaning up some text data, and have a quick question. I have the following data from which I am trying to extract the information inside brackets. I currently use -strpos- and -strrpos- functions to spot the brackets that appear first and last in a row, and extract the information using -substr-. However, if there are more than two sets of brackets in a row, this approach doesn't work. Could you please help me on how to go about handling such cases?
Kindly let me know if something is unclear.
Thanks very much!
Krishna
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str25 string "(ab)cd(e)" "abcd(efg)" "(abc)d(efg)i(jkl)" "(abc)defg)i(jkl)" "(abc)(defg)i(jkl)mno(pqr)" end
0 Response to Extracting strings
Post a Comment