Replace with non-matching group

#1

The doc of replace has this example:

julia> replace("The quick foxes run quickly.", r"fox(es)?" => s"bus\1")
"The quick buses run quickly."

this works fine however

julia> replace("The quick fox run quickly.", r"fox(es)?" => s"bus\1")
ERROR: PCRE error: requested value is not set

I imagine that’s not desirable? I have two questions:

  1. am I missing something and is this working the way it should?
  2. is there a workaround I can use for Julia 1+ ? so something which would do
julia> alt_replace("The quick fox run quickly.", r"fox(es)?" => s"bus\1")
"The quick bus run quickly."

Thanks

(Edit: this is on 1.2)

Edit: issue opened with full description including corresponding (working) python code: https://github.com/JuliaLang/julia/issues/31456