From 79bba8af69c77b5417498527ca3a9fefaf8b2c0c Mon Sep 17 00:00:00 2001 From: Noah from ProvocaTeach <68936059+ProvocaTeach@users.noreply.github.com> Date: Thu, 14 Jul 2022 12:03:05 -0700 Subject: [PATCH] Define regular expressions; clarify PCRE version (#46033) * Add a definition of regular expressions, with an illustrative example * Clarify that Julia uses version 2 of PCRE * Add semantic link descriptor to PCRE2 spec link --- doc/src/manual/strings.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/src/manual/strings.md b/doc/src/manual/strings.md index be3f76bb99683..32f4c29af9311 100644 --- a/doc/src/manual/strings.md +++ b/doc/src/manual/strings.md @@ -770,9 +770,10 @@ are some examples of non-standard string literals. Users and packages may also d Further documentation is given in the [Metaprogramming](@ref meta-non-standard-string-literals) section. ## [Regular Expressions](@id man-regex-literals) +Sometimes you are not looking for an exact string, but a particular *pattern*. For example, suppose you are trying to extract a single date from a large text file. You don’t know what that date is (that’s why you are searching for it), but you do know it will look something like `YYYY-MM-DD`. Regular expressions allow you to specify these patterns and search for them. -Julia has Perl-compatible regular expressions (regexes), as provided by the [PCRE](https://www.pcre.org/) -library (a description of the syntax can be found [here](https://www.pcre.org/current/doc/html/pcre2syntax.html)). Regular expressions are related to strings in two ways: the obvious connection is that +Julia uses version 2 of Perl-compatible regular expressions (regexes), as provided by the [PCRE](https://www.pcre.org/) +library (see the [PCRE2 syntax description](https://www.pcre.org/current/doc/html/pcre2syntax.html) for more details). Regular expressions are related to strings in two ways: the obvious connection is that regular expressions are used to find regular patterns in strings; the other connection is that regular expressions are themselves input as strings, which are parsed into a state machine that can be used to efficiently search for patterns in strings. In Julia, regular expressions are input