I define regular expressions for a number (or variable) zl and a signed number (or variable) zlvz:
(setq zl "([\\.0-9a-zA-Z]+)(([eEdD])(+|-)?([\\.0-9a-zA-Z]+))?")
(setq zlvz "((+|-)?[\\.0-9a-zA-Z]+)(([eEdD])(+|-)?([\\.0-9a-zA-Z]+))?")
Then I try to find all powers:
? (regex-seek (concat zl "\\^" zlvz) zzz)
= (25 5)
which obviously does not work.
However if I try instead
? (regex-rseek "([\\.0-9a-zA-Z]+)(([eEdD])(+|-)?([\\.0-9a-zA-Z]+))?\\^((+|-)?[\\.0-9a-zA-Z]+)(([eEdD])(+|-)?([\\.0-9a-zA-Z]+))?" zzz)
= ((25 5) (75 4) (87 3) (112 4) (142 4) (161 4) (178 4) (193 4) (212 4) (225 5) (243 4) (256 6) (266 3) (270 4) (285 4) (292 7))
I get the desired results.
Whereby the used regular expressions appear equal
? (= "([\\.0-9a-zA-Z]+)(([eEdD])(+|-)?([\\.0-9a-zA-Z]+))?\\^((+|-)?[\\.0-9a-zA-Z]+)(([eEdD])(+|-)?([\\.0-9a-zA-Z]+))?" (concat zl "\\^" zlvz))
= t
Also when simply storing the whole regex in z
(setq z "([\\.0-9a-zA-Z]+)(([eEdD])(+|-)?([\\.0-9a-zA-Z]+))?\\^((+|-)?[\\.0-9a-zA-Z]+)(([eEdD])(+|-)?([\\.0-9a-zA-Z]+))?")
it does not work :(
(regex-seek z zzz)
= (25 5)
Is this a feature?
j
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
another question concerning regular expressions. I've the following equation:
(setq zzz " matrix([1/(sqrt((3.5E3*rr^-2*y3*-2.3E-1*rr*y2+y1)^(-0.2/x)-0.02)+1),sqrt(y1^2+1)*sin(K^2)*(R0+rr)*(h*y1/(sqrt(y1^2+1)*(R0+rr))+1)*(rr/(sqrt(y1^2+1)*R0+rr*sqrt(y1^2+1))+my/sqrt(y1^2+1))/(sqrt(y1^2+1)*R0+rr*sqrt(y1^2+1)),tan(rr1^3+ro/tz)+sqrt(zt^2))],[sin(ff^9.2),E-a^2,y2^3],[31,-(y1+y2^9),-y4^-0.5+er*3]);"
I define regular expressions for a number (or variable) zl and a signed number (or variable) zlvz:
(setq zl "([\\.0-9a-zA-Z]+)(([eEdD])(+|-)?([\\.0-9a-zA-Z]+))?")
(setq zlvz "((+|-)?[\\.0-9a-zA-Z]+)(([eEdD])(+|-)?([\\.0-9a-zA-Z]+))?")
Then I try to find all powers:
? (regex-seek (concat zl "\\^" zlvz) zzz)
= (25 5)
which obviously does not work.
However if I try instead
? (regex-rseek "([\\.0-9a-zA-Z]+)(([eEdD])(+|-)?([\\.0-9a-zA-Z]+))?\\^((+|-)?[\\.0-9a-zA-Z]+)(([eEdD])(+|-)?([\\.0-9a-zA-Z]+))?" zzz)
= ((25 5) (75 4) (87 3) (112 4) (142 4) (161 4) (178 4) (193 4) (212 4) (225 5) (243 4) (256 6) (266 3) (270 4) (285 4) (292 7))
I get the desired results.
Whereby the used regular expressions appear equal
? (= "([\\.0-9a-zA-Z]+)(([eEdD])(+|-)?([\\.0-9a-zA-Z]+))?\\^((+|-)?[\\.0-9a-zA-Z]+)(([eEdD])(+|-)?([\\.0-9a-zA-Z]+))?" (concat zl "\\^" zlvz))
= t
Also when simply storing the whole regex in z
(setq z "([\\.0-9a-zA-Z]+)(([eEdD])(+|-)?([\\.0-9a-zA-Z]+))?\\^((+|-)?[\\.0-9a-zA-Z]+)(([eEdD])(+|-)?([\\.0-9a-zA-Z]+))?")
it does not work :(
(regex-seek z zzz)
= (25 5)
Is this a feature?
j
sorry,
missed the r in regex-seek -> regex-rseek ... and everything works fine
j