octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Backslashes in regular expression replacement patterns


From: Michael D. Godfrey
Subject: Re: Backslashes in regular expression replacement patterns
Date: Tue, 16 Oct 2012 16:28:01 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121009 Thunderbird/16.0

On 10/16/2012 12:29 PM, Rik wrote:
regexprep ('a', '(\w)', "\\$1")

Should it be '\a' or '$1'? 

In the first case, one would get the same result from using a replacement
pattern of '\\$1' or "\\$1" which is odd because usually single quotes and
double quotes are not interchangeable.  On the other hand, Perl would
return '\a' for the regexprep above.
Matlab R2009b returns '\a'


reply via email to

[Prev in Thread] Current Thread [Next in Thread]