Regular expression (nonfiction): Difference between revisions
No edit summary |
No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
A '''regular expression''', '''regex''' or '''regexp''' (sometimes called a rational expression) is a sequence of characters that define a search pattern. Usually this pattern is used by string searching algorithms for "find" or "find and replace" operations on strings, or for input validation. It is a technique developed in theoretical computer science and formal language theory. | A '''regular expression''', '''regex''' or '''regexp''' (sometimes called a '''rational expression''') is a sequence of characters that define a search pattern. Usually this pattern is used by string searching algorithms for "find" or "find and replace" operations on strings, or for input validation. It is a technique developed in theoretical computer science and formal language theory. | ||
The concept arose in the 1950s when the American mathematician Stephen Cole Kleene formalized the description of a regular language. The concept came into common use with Unix text-processing utilities. Since the 1980s, different syntaxes for writing regular expressions exist, one being the POSIX standard and another, widely used, being the Perl syntax. | The concept arose in the 1950s when the American mathematician [[Stephen Cole Kleene (nonfiction)|Stephen Cole Kleene]] formalized the description of a [[Regular language (nonfiction)|regular language]]. The concept came into common use with Unix text-processing utilities. Since the 1980s, different syntaxes for writing regular expressions exist, one being the POSIX standard and another, widely used, being the Perl syntax. | ||
Regular expressions are used in search engines, search and replace dialogs of word processors and text editors, in text processing utilities such as sed and AWK and in lexical analysis. Many programming languages provide regex capabilities, built-in or via libraries. | Regular expressions are used in search engines, search and replace dialogs of word processors and text editors, in text processing utilities such as sed and AWK and in lexical analysis. | ||
Many programming languages provide regex capabilities, built-in or via libraries. | |||
== Examples == | |||
Remove pairs of square brackets and their contents: | |||
<code> | |||
\[[^\[]*\] | |||
</code> | |||
Source: [https://stackoverflow.com/questions/43246115/java-regular-expression-matching-square-brackets/43246127 Stack Overflow] | |||
== In the News == | |||
<gallery> | |||
</gallery> | |||
== Fiction cross-reference == | |||
* [[Can This Regex Be Saved?]] - reality television program | |||
* [[Gnomon algorithm]] | |||
* [[Gnomon Chronicles]] | |||
== Nonfiction cross-reference == | |||
* [[Stephen Cole Kleene (nonfiction)]] - inventor of regular expressions | |||
* [[Regular language (nonfiction)]] | |||
External links: | |||
* [https://en.wikipedia.org/wiki/Regular_expression Regular expression] @ Wikipedia | |||
[[Category:Nonfiction (nonfiction)]] | [[Category:Nonfiction (nonfiction)]] | ||
[[Category:Computer science (nonfiction)]] | [[Category:Computer science (nonfiction)]] | ||
[[Category:To do (nonfiction)]] | [[Category:To do (nonfiction)]] |
Latest revision as of 14:48, 23 June 2019
A regular expression, regex or regexp (sometimes called a rational expression) is a sequence of characters that define a search pattern. Usually this pattern is used by string searching algorithms for "find" or "find and replace" operations on strings, or for input validation. It is a technique developed in theoretical computer science and formal language theory.
The concept arose in the 1950s when the American mathematician Stephen Cole Kleene formalized the description of a regular language. The concept came into common use with Unix text-processing utilities. Since the 1980s, different syntaxes for writing regular expressions exist, one being the POSIX standard and another, widely used, being the Perl syntax.
Regular expressions are used in search engines, search and replace dialogs of word processors and text editors, in text processing utilities such as sed and AWK and in lexical analysis.
Many programming languages provide regex capabilities, built-in or via libraries.
Examples
Remove pairs of square brackets and their contents:
\[[^\[]*\]
Source: Stack Overflow
In the News
Fiction cross-reference
- Can This Regex Be Saved? - reality television program
- Gnomon algorithm
- Gnomon Chronicles
Nonfiction cross-reference
- Stephen Cole Kleene (nonfiction) - inventor of regular expressions
- Regular language (nonfiction)
External links:
- Regular expression @ Wikipedia