I have an awful large expression that expresses the power in terms of the ** operator and need to convert it to code that uses the pow function. That is, I look for a regular expression for finding and replacing terms like a*b**N*d by a*pow(b,N), where N is an integer.
Here, a, b, and c are terms that may contain xy*-+() and integers and a*, *d may not be present.
I am somehow stuck with escaping all these characters. I am ready to invest some manual postprocessing, so the regex should be robust but not necessarily perfect.
EDIT: As Kent pointed out, there is a difficulty when b contains nested brackets. In my case there are no nested brackets. The terms are all of the form as given in the comment below.