I need to extend a regex pattern in C#. The current pattern is capturing any multiplication or division in the formula:
([\+-]?\d+,*\d*[eE][\+-]?\d+|[\-\+]?\d+,*\d*)([\/\*])(-?\d+,*\d*[eE][\+-]?\d+|-?\d+,*\d*)
That means that if the expression is e.g. 12+18*3+4-3/3
, it will capture 18*3
and -3/3
. That is great.
Now I need to extend it, so that it captures the following example: 12+18*3+4-3/3+10*mod8
. It should first capture 18*3
, then -3/3
, as it did so far, but then it should capture 10mod8
(or 10*mod8
). How can I achieve this? Thanks.