I want to display some regular expression, like the following, in LaTeX math mode.
\[
(F+(A+I*)*)|(F*(A+I*)+)E
\]
However, the spacing is all wrong, because TeX formats + and * as binary operators, rather than as postfix ones. I would expect that the postfix operators would appear close to the preceding operand, and, in cases where the successor element is an operand, they would introduce some additional space to prevent the appearance's ambiguity.
An example formatted in the way I'd like it to be appears below. I have marked with red the places where additional spacing is unwanted and with green places where additional spacing is required. However, I'd be open to other formatting suggestions from typography experts.
Is there a way to handle this without adding manual spacing commands?