This is the input string: 23x^45*y or 2x^2 or y^4*x^3
.
I am matching ^[0-9]+
after letter x
. In other words I am matching x
followed by ^
followed by numbers. Problem is that I don't know that I am matching x
, it could be any letter that I stored as variable in my char array.
For example:
foreach (char cEle in myarray) // cEle is letter in char array x, y, z, ...
{
match CEle in regex(input) //PSEUDOCODE
}
I am new to regex and I new that this can be done if I define regex variables, but I don't know how.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…