A regular expression is not able to count. This is because there is a finite number of states. Consider the language that is specified by a<sup><small>n</small></sup>ba<sup><small>n</small></sup>. Examples of this language include b, aba, aabaa, aaabaaa, etc... A regular expression - being a [[finite state automaton]] itself - has a finite number of states that it can be in. If there a point at which the state loops back on itself it is no longer able to match that language. | A regular expression is not able to count. This is because there is a finite number of states. Consider the language that is specified by a<sup><small>n</small></sup>ba<sup><small>n</small></sup>. Examples of this language include b, aba, aabaa, aaabaaa, etc... A regular expression - being a [[finite state automaton]] itself - has a finite number of states that it can be in. If there a point at which the state loops back on itself it is no longer able to match that language. |