aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/re.erl
diff options
context:
space:
mode:
authorHenrik Nord <[email protected]>2012-10-01 10:02:39 +0200
committerHenrik Nord <[email protected]>2012-10-01 10:05:45 +0200
commitc8c2571ad89c466518f48bfbf32f997f37a47d31 (patch)
tree5d435ce3e96efa44748f9207cc272bce9bf8ba70 /lib/stdlib/src/re.erl
parenta4a8f703c4ef1fa0f8ab9f597afa3a8e3e0e1f28 (diff)
parent264e667b86381528131c45c9b6e8f54ad168c73f (diff)
downloadotp-c8c2571ad89c466518f48bfbf32f997f37a47d31.tar.gz
otp-c8c2571ad89c466518f48bfbf32f997f37a47d31.tar.bz2
otp-c8c2571ad89c466518f48bfbf32f997f37a47d31.zip
Merge branch 'vs/re_back_reference'
* vs/re_back_reference: extend re back reference syntax with \g escape sequence OTP-10455
Diffstat (limited to 'lib/stdlib/src/re.erl')
-rw-r--r--lib/stdlib/src/re.erl6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/stdlib/src/re.erl b/lib/stdlib/src/re.erl
index 359afc8c14..c5109ec455 100644
--- a/lib/stdlib/src/re.erl
+++ b/lib/stdlib/src/re.erl
@@ -409,6 +409,12 @@ apply_mlist(Subject,Replacement,Mlist) ->
precomp_repl(<<>>) ->
[];
+precomp_repl(<<$\\,$g,${,Rest/binary>>) when byte_size(Rest) > 0 ->
+ {NS, <<$},NRest/binary>>} = pick_int(Rest),
+ [list_to_integer(NS) | precomp_repl(NRest)];
+precomp_repl(<<$\\,$g,Rest/binary>>) when byte_size(Rest) > 0 ->
+ {NS,NRest} = pick_int(Rest),
+ [list_to_integer(NS) | precomp_repl(NRest)];
precomp_repl(<<$\\,X,Rest/binary>>) when X < $1 ; X > $9 ->
%% Escaped character
case precomp_repl(Rest) of