Im trying to make a Regex pattern that matches only if:
A "x" is after a digit, returns match for example if:
3x + 1
2x
40x
2 + 33x
Dont match if:
x + 2
2 + x
is it possible?
>Solution :
In Python the following regex should work
(\d+)x
I’m assuming you want to capture the number attached to "x" in these equations. I’m also making a (rather big) assumption here that the equations provided will be correct i.e. the equations are valid.