Changes

Jump to navigation Jump to search
201 bytes added ,  22:44, February 8, 2010
→‎Limitations of regular expressions: sticking the formal definition for any math majors who wander by
Line 26: Line 26:  
* /[1-9][0-9]*(\.0|([1-9][0-9]*))+/ - matches version numbers: 1, 1.0, 2.3, 103.4, 42.5.6.8.9, 7.0.8.9
 
* /[1-9][0-9]*(\.0|([1-9][0-9]*))+/ - matches version numbers: 1, 1.0, 2.3, 103.4, 42.5.6.8.9, 7.0.8.9
   −
== Limitations of regular expressions ==
+
== Formal definition and Limitations ==
 +
 
 +
A '''regular expression''' is particular instance of a non-[[deterministic]] [[finite]] state [[automaton]].  Regular expressions are a [[type-3 grammar]] in the [[Chomsky hierarchy]] of [[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.
 
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.
Siteadmin, Check users, nsTeam1RO, nsTeam1RW, nsTeam1_talkRO, nsTeam1_talkRW, oversight, Administrators
30,650

edits

Navigation menu