To be fair it is unconstructive. If you read the question carefully, it is clear is can be solved using a regex because it is about identifying tokens, not about parsing them into a tree. Parsers typically use regexes for the tokenization stage - indeed, what else would you use?
The answers are ridiculing the OP for asking a totally reasonable question.
The answers are ridiculing the OP for asking a totally reasonable question.