Skip to content

Commit c067271

Browse files
committed
Deprecate callable Regex objects
1 parent c9c99f3 commit c067271

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

NEWS.md

+2
Original file line numberDiff line numberDiff line change
@@ -1069,6 +1069,8 @@ Deprecated or removed
10691069

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

1072+
* `Regex` objects are no longer callable. Use `isfound` instead ([#26283]).
1073+
10721074
* The methods of `range` based on positional arguments have been deprecated in favor of
10731075
keyword arguments ([#25896]).
10741076

base/deprecated.jl

+1
Original file line numberDiff line numberDiff line change
@@ -1457,6 +1457,7 @@ end
14571457
# PR #26283
14581458
@deprecate contains(haystack, needle) isfound(needle, haystack)
14591459
@deprecate contains(s::AbstractString, r::Regex, offset::Integer) isfound(r, s, offset=offset)
1460+
@deprecate (r::Regex)(s) isfound(r, s)
14601461

14611462
# Issue #25786
14621463
@deprecate_binding DevNull devnull

base/regex.jl

-2
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,6 @@ function isfound(r::Regex, s::SubString; offset::Integer=0)
153153
r.match_data)
154154
end
155155

156-
(r::Regex)(s) = isfound(r, s)
157-
158156
"""
159157
match(r::Regex, s::AbstractString[, idx::Integer[, addopts]])
160158

0 commit comments

Comments
 (0)