Skip to content

Commit

Permalink
regex.jl: add new doctests for findall (#34271)
Browse files Browse the repository at this point in the history
  • Loading branch information
josobar authored and StefanKarpinski committed Jan 6, 2020
1 parent 38a0ea5 commit 74e7287
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions base/regex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,23 @@ matching sequence is found, like the return value of [`findnext`](@ref).
If `overlap=true`, the matching sequences are allowed to overlap indices in the
original string, otherwise they must be from disjoint character ranges.
# Examples
```jldoctest
julia> findall("a", "apple")
1-element Array{UnitRange{Int64},1}:
1:1
julia> findall("nana", "banana")
1-element Array{UnitRange{Int64},1}:
3:6
julia> findall("a", "banana")
3-element Array{UnitRange{Int64},1}:
2:2
4:4
6:6
```
"""
function findall(t::Union{AbstractString,Regex}, s::AbstractString; overlap::Bool=false)
found = UnitRange{Int}[]
Expand Down

0 comments on commit 74e7287

Please sign in to comment.