Skip to content

Commit

Permalink
Deprecate callable Regex objects
Browse files Browse the repository at this point in the history
  • Loading branch information
ararslan committed Mar 2, 2018
1 parent c9c99f3 commit c067271
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,8 @@ Deprecated or removed

* `contains` has been deprecated in favor of a more general `isfound` function ([#26283]).

* `Regex` objects are no longer callable. Use `isfound` instead ([#26283]).

* The methods of `range` based on positional arguments have been deprecated in favor of
keyword arguments ([#25896]).

Expand Down
1 change: 1 addition & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1457,6 +1457,7 @@ end
# PR #26283
@deprecate contains(haystack, needle) isfound(needle, haystack)
@deprecate contains(s::AbstractString, r::Regex, offset::Integer) isfound(r, s, offset=offset)
@deprecate (r::Regex)(s) isfound(r, s)

# Issue #25786
@deprecate_binding DevNull devnull
Expand Down
2 changes: 0 additions & 2 deletions base/regex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,6 @@ function isfound(r::Regex, s::SubString; offset::Integer=0)
r.match_data)
end

(r::Regex)(s) = isfound(r, s)

"""
match(r::Regex, s::AbstractString[, idx::Integer[, addopts]])
Expand Down

0 comments on commit c067271

Please sign in to comment.