mercredi 2 mai 2018

Using regex_replace on bracketed expression

I want to code a small program to convert the syntax of correctly bracketed mathematical expressions.

For example: sin(-1/(-1+x)/x)) should become sin[-1/(-1+x)/x])

As you can see, the only the brackets for the sin function itself should be replaced. Is there a way to do so without touching the inner content of the brackets, using regex_replace()?

(This is for converting maple output to mathematica output. The solutions I've found on the web do not seem to be usable for our system setup, hence the need for a selfmade program)

Thank you in advance!

Aucun commentaire:

Enregistrer un commentaire