Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Regular expression
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Sequence of characters that forms a search pattern}} {{Redirect|Regex|the comic book|Re:Gex{{!}}''Re:Gex''}} {{Redirect|.*|the C++ operator|Pointer (computer science)#Pointer-to-member}} [[File:Antony08.gif|thumb|upright=1.5|{{legend|#b0d0f0|outline=#b0d0f0|text=Blue|highlights show the match results of the regular expression pattern: <syntaxhighlight lang="ragel" inline>/r[aeiou]+/g</syntaxhighlight> (lower case ''r'' followed by one or more lower-case vowels).}}]] A '''regular expression''' (shortened as '''regex''' or '''regexp'''),<ref>{{cite web |url=https://www.regular-expressions.info/tutorial.html |title=Regular Expression Tutorial - Learn How to Use Regular Expressions |last=Goyvaerts |first=Jan |website=Regular-Expressions.info |access-date=2016-10-31 |url-status=live |archive-date=2016-11-01 |archive-url=https://web.archive.org/web/20161101212501/http://www.regular-expressions.info/tutorial.html}}</ref> sometimes referred to as '''rational expression''',<ref name="Mitkov2003">{{cite book |last=Mitkov |first=Ruslan |title=The Oxford Handbook of Computational Linguistics |url=https://books.google.com/books?id=yl6AnaKtVAkC&pg=PA754 |date=2003 |publisher=Oxford University Press |isbn=978-0-19-927634-9 |page=754 |access-date=2016-07-25 |archive-date=2017-02-28 |archive-url=https://web.archive.org/web/20170228030346/https://books.google.com/books?id=yl6AnaKtVAkC&pg=PA754 |url-status=live}}</ref><ref name="Lawson2003">{{cite book |last=Lawson |first=Mark V. |title=Finite Automata |url=https://books.google.com/books?id=MDQ_K7-z2AMC&pg=PA98 |date=17 September 2003 |publisher=CRC Press |isbn=978-1-58488-255-8 |pages=98β100 |access-date=25 July 2016 |archive-date=27 February 2017 |archive-url=https://web.archive.org/web/20170227195128/https://books.google.com/books?id=MDQ_K7-z2AMC&pg=PA98 |url-status=live}}</ref> is a sequence of [[character (computing)|characters]] that specifies a [[pattern matching|match pattern]] in [[string (computer science)|text]]. Usually such patterns are used by [[string-searching algorithm]]s for "find" or "find and replace" operations on [[string (computer science)|strings]], or for [[data validation|input validation]]. Regular expression techniques are developed in [[theoretical computer science]] and [[formal language]] theory. The concept of regular expressions began in the 1950s, when the American mathematician [[Stephen Cole Kleene]] formalized the concept of a [[regular language]]. They came into common use with [[Unix]] text-processing utilities. Different [[syntax (programming languages)|syntaxes]] for writing regular expressions have existed since the 1980s, one being the [[POSIX]] standard and another, widely used, being the [[Perl]] syntax. Regular expressions are used in [[search engine]]s, in search and replace dialogs of [[word processor]]s and [[text editor]]s, in [[text processing]] utilities such as [[sed]] and [[AWK]], and in [[lexical analysis]]. Regular expressions are supported in many programming languages. Library implementations are often called an "[[software engine|engine]]",<ref>{{cite web |title=How a Regex Engine Works Internally |url=https://www.regular-expressions.info/engine.html |website=regular-expressions.info |access-date=24 February 2024}}</ref><ref>{{cite web |title=How Do You Actually Use Regex? |url=https://www.howtogeek.com/devops/how-do-you-actually-use-regex/ |website=howtogeek.com |date=11 March 2020 |access-date=24 February 2024 |author-first1=Anthony |author-last1=Heddings}}</ref> and [[comparison of regular expression engines|many of these]] are available for reuse.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)