[Haskell-cafe] problem with regex replace with back references

Daniel Fischer daniel.is.fischer at web.de
Mon May 24 11:14:52 EDT 2010


On Monday 24 May 2010 17:08:50, Juan Maiz wrote:
> I'm trying use subRegex to replace using back references just like the
> docs says:
> http://hackage.haskell.org/packages/archive/regex-compat/0.92/doc/html/T
>ext-Regex.html#v%3AsubRegex
>
> But when i try to replace with \1 i got \SOH and not "e". Can anyone
> help?
>
> subRegex (mkRegex "e") "hello" "\1"
> => "h\SOHllo"

Try

subRegex (mkRegex "e") "hello" "\\1"

>
> Thanks in advance



More information about the Haskell-Cafe mailing list