I was wondering if I can define a Regular Expression to check whether a given input matches the RPN expression , i.e. whether the given input is valuid or not?
I am not very familiar with Regex unfortunately, so I was wondering if it is possible to define a regular expression to validate the input for postfix.
Many thanks Taz
Formally, no; RPN would require a context-free grammar, which regular expressions cannot express. However, it might be possible to do so with a "regular expression" package or library, since they can contain features that are outside of the formal definition of regular expressions.