Dear all,
I was wondering whether the issue of regexs() in MATA mentioned here has already been solved. In my case the problem is the following. Assume I have matrix X form which I need to get matrix Y using regular expressions (This problem is simplified for the explanatory purposes).
However, if I do the following I only get the value of the last row
Which is not what I need. Then, I tried to solve this problem by using regexr(). However, notice that the second time it is executed, it does not work as expected.
So, does anyone of you know how to use correctly regexs() in MATA?
Thank you so much,
Pablo
I was wondering whether the issue of regexs() in MATA mentioned here has already been solved. In my case the problem is the following. Assume I have matrix X form which I need to get matrix Y using regular expressions (This problem is simplified for the explanatory purposes).
Code:
X = "H 2000 A" \ "H 2001 A" \ "H 2002 A" \ "H 2003 A" Y = 2000 \ 20001 \ 2002 \ 2003
Code:
regexm(X, "([0-9]+)") Y = regexs(1) Y
Code:
Y=X Y = regexr(Y, "([A-Z]+)", "") Y = regexr(Y, "([A-Z]+)", "") // This does not remove the "A". I solved it by including a space " ", but it is not supposed to be so --> regexr(Y, " ([A-Z]+)", "") Y
Thank you so much,
Pablo
Comment