From 064b2813f60ac519e26c2f2e4bfc81197a37c499 Mon Sep 17 00:00:00 2001 From: GianmarcoCuppari Date: Sat, 4 Oct 2025 17:06:01 +0200 Subject: [PATCH] Add 'See also' sections to regex function docstring - Add cross-references between match, eachmatch, count - Add cross-references between startswith and endswith - Link related functions like occursin, findfirst, findall - Addresses #56752 --- base/regex.jl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/base/regex.jl b/base/regex.jl index 2bd47c271ce75..776615c93e4c4 100644 --- a/base/regex.jl +++ b/base/regex.jl @@ -334,6 +334,9 @@ See also [`occursin`](@ref) and [`endswith`](@ref). julia> startswith("JuliaLang", r"Julia|Romeo") true ``` +# See also +[`endswith`](@ref), [`occursin`](@ref), [`match`](@ref) + """ function startswith(s::AbstractString, r::Regex) compile(r) @@ -366,6 +369,9 @@ See also [`occursin`](@ref) and [`startswith`](@ref). julia> endswith("JuliaLang", r"Lang|Roberts") true ``` +# See also +[`startswith`](@ref), [`occursin`](@ref), [`match`](@ref) + """ function endswith(s::AbstractString, r::Regex) compile(r) @@ -421,6 +427,9 @@ julia> m.match julia> match(rx, "cabac", 3) === nothing true ``` +# See also +[`eachmatch`](@ref), [`occursin`](@ref), [`findfirst`](@ref) + """ function match end @@ -558,6 +567,9 @@ julia> count(r"a(.)a", "cabacabac", overlap=true) julia> count(r"a(.)a", "cabacabac") 2 ``` +# See also +[`eachmatch`](@ref), [`occursin`](@ref), [`findall`](@ref) + """ function count(t::Union{AbstractChar,AbstractString,AbstractPattern}, s::AbstractString; overlap::Bool=false) n = 0 @@ -789,6 +801,9 @@ julia> collect(eachmatch(rx, "a1a2a3a", overlap = true)) RegexMatch("a2a") RegexMatch("a3a") ``` +# See also +[`match`](@ref), [`findall`](@ref), [`count`](@ref) + """ eachmatch(re::Regex, str::AbstractString; overlap = false) = RegexMatchIterator(re, str, overlap)