From c067271354c7862a4ee6d6f35e78342228e76cdb Mon Sep 17 00:00:00 2001 From: Alex Arslan Date: Fri, 2 Mar 2018 15:07:34 -0800 Subject: [PATCH] Deprecate callable Regex objects --- NEWS.md | 2 ++ base/deprecated.jl | 1 + base/regex.jl | 2 -- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index c87f16568d9bb3..7554528836142b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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]). diff --git a/base/deprecated.jl b/base/deprecated.jl index b0db5a9bb231d9..b3d79ecc397ede 100644 --- a/base/deprecated.jl +++ b/base/deprecated.jl @@ -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 diff --git a/base/regex.jl b/base/regex.jl index f88192621476b8..d44c531477a56a 100644 --- a/base/regex.jl +++ b/base/regex.jl @@ -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]])