Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions base/regex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding match is a good idea, though it just needs to be added to the existing see also section above.

Same for the endswith docstring below

"""
function startswith(s::AbstractString, r::Regex)
compile(r)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down