[erlang-patches] extended back references in re:replace/3,4

Vance Shipley <>
Wed Apr 4 15:47:30 CEST 2012


I created a patch to resolve the use case probem I have with
the current implementation of re:replace/3,4 with regard to
using back references on numeric digit strings:

	git fetch git://github.com/vances/otp.git re_back_reference

	https://github.com/vances/otp/compare/re_back_reference
	https://github.com/vances/otp/compare/re_back_reference

Test cases and updated the documentation are included.

I hope you'll accept it for inclusion in a future release.

-- 
	-Vance

On Thu, Mar 08, 2012 at 09:28:19PM +0530, Vance Shipley wrote:
}  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-patches mailing list