Skip to content

Commit 9f2a967

Browse files
ChristianKurzKristofferC
authored andcommitted
add Regex documentation (#28703)
add `Regex` documentation. (#26919) (cherry picked from commit 31c9ae9)
1 parent a920071 commit 9f2a967

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

base/regex.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ include("pcre.jl")
77
const DEFAULT_COMPILER_OPTS = PCRE.UTF | PCRE.NO_UTF_CHECK | PCRE.ALT_BSUX | PCRE.UCP
88
const DEFAULT_MATCH_OPTS = PCRE.NO_UTF_CHECK
99

10+
"""
11+
Regex(pattern[, flags])
12+
13+
A type representing a regular expression. `Regex` objects can be used to match strings
14+
with [`match`](@ref).
15+
16+
`Regex` objects can be created using the [`@r_str`](@ref) string macro. The
17+
`Regex(pattern[, flags])` constructor is usually used if the `pattern` string needs
18+
to be interpolated. See the documentation of the string macro for details on flags.
19+
"""
1020
mutable struct Regex
1121
pattern::String
1222
compile_options::UInt32
@@ -81,6 +91,8 @@ listed after the ending quote, to change its behaviour:
8191
`\\s`, `\\W`, `\\w`, etc. match based on Unicode character properties. With this option,
8292
these sequences only match ASCII characters.
8393
94+
See `Regex` if interpolation is needed.
95+
8496
# Examples
8597
```jldoctest
8698
julia> match(r"a+.*b+.*?d\$"ism, "Goodbye,\\nOh, angry,\\nBad world\\n")

0 commit comments

Comments
 (0)