[erlang-questions] regexp behaviour
shehan
shehan@REDACTED
Tue Mar 18 02:09:55 CET 2008
Hi Robert,
Tx for help. It is working.
BR,
Shehan
_____
From: Robert Virding [mailto:rvirding@REDACTED]
Sent: Sunday, March 16, 2008 1:46 AM
To: shehan
Cc: erlang-questions@REDACTED; chinthaka@REDACTED
Subject: Re: [erlang-questions] regexp behaviour
Hi,
If you quote the '&' character with \ then you will get a & in the out put
string. So
Str1 = "String with \\& character"
N.B. you need an extra \ because it is in a string and the string parsing
converts \\ into \ in the resultant string.
Robert
On 15/03/2008, shehan <shehan@REDACTED> wrote:
Hi all,
Is the some way to stop the following behaviour of the "sub" function in the
"regexp" module
Str1 = "String with & character"
Str2 = "Replace the following tag <replace> with str1"
regexp:sub(Str2, "<replace>", Str1).
{ok, NewStr, Count} = regexp:gsub(Str1, ["<ad2>"], Ad2).
NewStr.
"Replace the following tag String with <replace> character with str1"
The <replace> is replaced by the content of Str1, but the & character in
Str1 has been replaced by the
replaced character set <replace>. is there some way to stop this from
happening.
Thanx
Shehan
_______________________________________________
erlang-questions mailing list
erlang-questions@REDACTED
http://www.erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080318/59c52c46/attachment.htm>
More information about the erlang-questions
mailing list