[erlang-questions] backquotes in re:replace/3

Gustav Simonsson <>
Thu Mar 8 19:01:12 CET 2012


Is this what you want todo?

re:replace("012345", "0(...)45", "x\\1\1").  
[[<<"x">>,<<"123">>,<<1>>]]

Regards,
Gustav Simonsson

Sent from my PC

----- Original Message -----
> From: "Vance Shipley" <>
> To: 
> Sent: Thursday, 8 March, 2012 4:58:19 PM
> Subject: [erlang-questions] backquotes in re:replace/3
> 
> Is there a syntax supported which allows us to insert a back
> reference in a replacement followed directly by digits?  I
> haven't found one yet.
> 
>    Eshell V5.9  (abort with ^G)
>    1> re:replace("012345", "0(...)45", "\\1bcde").
>    [[<<"123">>,<<"bcde">>]]
>    2> re:replace("012345", "0(...)45", "\\16789").
>    [[<<>>]]
>    3> re:replace("012345", "0(...)45", "\\g{1}6789").
>    [<<"g{1}6789">>]
> 
> 
> --
> 	-Vance
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
> 



More information about the erlang-questions mailing list