tags:

views:

652

answers:

5

Why are regular expressions called regular expressions?

+11  A: 

Why are they called "regular expressions?"

Regular expressions trace back to the work of an American mathematician by the name of Stephen Kleene (one of the most influential figures in the development of theoretical computer science) who developed regular expressions as a notation for describing what he called "the algebra of regular sets." His work eventually found its way into some early efforts with computational search algorithms, and from there to some of the earliest text-manipulation tools on the Unix platform (including ed and grep). In the context of computer searches, the "*" is formally known as a "Kleene star."

From here.

Mitch Wheat
... and that's why we have kleenex (google it) ;-)
corlettk
A: 

A brief history of regular expressions

Glen
+18  A: 

They are based on regular languages.

Oliver N.
Why did it take 3 answers to get to "regular languages" :P
Aiden Bell
i wondered that as well, was just about to post the same link, +1
RobV
+1. Although, most current implementations are not really regular anymore.
Mehrdad Afshari
So, one might wonder, why regular languages are called "regular". Can you notice a circle in definition here? :P
volodyako
@volodyako: Because there exists a regular *grammar* for those languages :P
Mehrdad Afshari
and why is the grammer called 'regular' because of Stephen Kleen's work!
Mitch Wheat
You've got to love one of the Regular Language definitions in Wikipedia: "... it is the preimage of a subset of a finite monoid under a homomorphism from the free monoid on its alphabet". Of course!
Nick Pierpoint
@Mehrdad: your reference to grammars is CIRCULAR as well. There exists a regular language for each regular grammar and vice versa; but this does not answer the question why this type of languages and grammars is called "regular".
volodyako
@volodyako It is no more circular than door and doorway. Related items often contain references to each other. Read the Wikipedia articles for the set of properties that make something regular.
Chas. Owens
@Chas. Owens (and others), "door" is a SUBstring of "doorway", which, I guess, is a kind of a set-theoretic argument. Assuming you were referring to grammars, there is MORE than a subset relation. In fact, there is an EQUIVALENCE relation (@Chas.: compare "door" and "DOOR", but this is only for you). Please read a more reliable reference, e.g., [S. Yu. Regular languages. Handbook of Formal Languages 1997]. Unfortunately [SO] is not handy enough to carry out such a discussion. In my Firefox, for example, it conceals trailing comments. Cheers :)
volodyako
+3  A: 

Because they used to in fact be regular. See http://en.wikipedia.org/wiki/Regular_language and http://en.wikipedia.org/wiki/Regular_expressions . Larry Wall advocates calling modern ones regexen because they are no longer anything like regular.

Matthew Flaschen
+2  A: 

Perhaps they are not regular and want to be regular? I am just jokking. :)

Guru
they should eat more fibre then..
ShoeLace
plus 1 for beeing funny
Peter Kofler
Thanks for that.. I am thinking if at all we have some thing known as "ir-regular expressions" how complex it would get? Jeez...
Guru