What \& means in regexp:sub/3

MAthuvathanan Mou. cowboymathu@REDACTED
Mon Jul 27 08:58:03 CEST 2009


Dear All,

In the manual for the regexp,

*sub(String, RegExp, New) -> SubRes
*

*Types:*

*String = RegExp = New = string()
SubRes = {ok,NewString,RepCount} | {error,errordesc()}
RepCount = integer()
*
 *Substitutes the first occurrence of a substring matching RegExp in
Stringwith the string
New. A & in the string New is replaced by the matched substring of String.
\& puts a literal & into the replacement string. *

Can someone please explain the sentence "*\& puts a literal & into the
replacement string. *" . If any example that will be helpful.

Thanks,
-- 
Mathuvathanan Mou.


More information about the erlang-questions mailing list