# Replace with non-matching group

**URL:** https://discourse.julialang.org/t/replace-with-non-matching-group/22187
**Category:** General Usage
**Created:** [March 22, 2019, 9:00am UTC](https://discourse.julialang.org/t/replace-with-non-matching-group/22187 "2019-03-22T09:00:16Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![tlienart](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tlienart/32/7640_2.png) [@tlienart](https://discourse.julialang.org/u/tlienart)
#### Post date: [March 22, 2019, 9:00am UTC](https://discourse.julialang.org/t/replace-with-non-matching-group/22187/1 "2019-03-22T09:00:17Z")

</div>

The doc of replace has this example:

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

```

this works fine however

```julia
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
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: [Replace with optional matching group fails when there is no match · Issue #31456 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/issues/31456)
