The W3C defines the HTML standard, CSS standard, and some other standards. I know there are other groups who define standards as well. Who defines the syntax of regular expressions?
-
24Don't know who they are but I'd like whatever they smoke– Yuriy GalanterNov 28, 2013 at 3:14
-
3If their was a real standard, implementations would not vary as much as they do (e.g. in whether characters have special meanings iff they are escaped or iff they are not escaped).– TimNov 28, 2013 at 10:01
-
2"The nice thing about standards is that there are so many of them to choose from." -- Andrew S. Tanenbaum– Keith ThompsonDec 13, 2013 at 22:37
5 Answers
Regular expressions are covered by several standard bodies, including IEEE standard 1003.1 (so called Posix): http://pubs.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap09.html
However, there are plenty of other approaches to regular expression syntax, the other popular one being Perl (PCRE). For a nice overview of all major regular expression implementations, including extensions, check out this useful resource: http://www.regular-expressions.info/tools.html
Regular expressions originated from unix and are a part of the Perl language. If a regular expression language is similar to Perl's regular expressions, it is called Perl Compatible Regular Expressions (PCRE
)
-
3Fun fact: PCREs and similar extensions have virtually nothing to do with regular languages - they're much more expressive (which is not always a good thing).– mikołakNov 28, 2013 at 9:23
-
1@TheTerribleSwiftTomato all regex flavors with backrefs are not regular. That's most of them (including those that are much simpler than PCRE and the like).– QtaxNov 4, 2014 at 0:59
-
@Qtax : I'm aware of that, my intent was to amend this answer, which seemed to suggest that the origin of regular expressions as a concept is strongly tied to Perl.– mikołakNov 5, 2014 at 7:44
Here are some organizations who have defined regular expressions:
And some individuals:
And here is a series on regular expressions:
- Regular Expression Matching can be Simple and Fast (but is slow in Java, Perl, PHP, Python, Ruby, ...)
- Regular Expression Matching: the Virtual Machine Approach
- Regular Expression Matching in the Wild
- How Google Code Search Worked
And here are a few engines:
And here is some source code:
There are many implementations, Perl's is the most popular one, used in many tools and libraries. As the Wikipedia article states:
Perl regular expressions have become a de facto standard, having a rich and powerful set of atomic expressions.
There are definitions under the IEEE POSIX standards (as mentioned here: http://en.wikipedia.org/wiki/Regular_expression#Standards) for POSIX compliance, but I guess not everyone follows these.