diff src/corefcn/regexp.cc @ 15173:8593bed236f1

doc: Document escape character processing within single quotes for regexp, warning, error. regexp.cc (regexp, regexprep): Add implementation note about doing escape character processing within single quotes of pattern and replacement string. error.cc (warning, error): Add implementation note about doing escape character processing when the number of input arguments is greater than two.
author Rik <rik@octave.org>
date Tue, 14 Aug 2012 15:17:39 -0700
parents e753177cde93
children
line wrap: on
line diff
--- a/src/corefcn/regexp.cc	Tue Aug 14 13:57:44 2012 -0700
+++ b/src/corefcn/regexp.cc	Tue Aug 14 15:17:39 2012 -0700
@@ -596,10 +596,7 @@
 end (@code{$}) of the string.\n\
 @end table\n\
 \n\
-In addition, the following escaped characters have special meaning.  Note,\n\
-it is recommended to quote @var{pat} in single quotes, rather than double\n\
-quotes, to avoid the escape sequences being interpreted by Octave before\n\
-being passed to @code{regexp}.\n\
+In addition, the following escaped characters have special meaning.\n\
 \n\
 @table @code\n\
 @item \\b\n\
@@ -633,6 +630,12 @@
 Match any non-digit\n\
 @end table\n\
 \n\
+Implementation Note: For compatibility with @sc{matlab}, ordinary escape\n\
+sequences (e.g., \"\\n\" => newline) are processed in @var{pat}\n\
+regardless of whether @var{pat} has been defined within single quotes.  Use\n\
+a second backslash to stop interpolation of the escape sequence (e.g.,\n\
+\"\\\\n\") or use the @code{regexptranslate} function.\n\
+\n\
 The outputs of @code{regexp} default to the order given below\n\
 \n\
 @table @var\n\
@@ -1258,6 +1261,11 @@
 This option is present for compatibility but is ignored.\n\
 \n\
 @end table\n\
+\n\
+Implementation Note: For compatibility with @sc{matlab}, ordinary escape\n\
+sequences (e.g., \"\\n\" => newline) are processed in both @var{pat}\n\
+and @var{repstr} regardless of whether they were defined within single quotes.  Use a second backslash to stop interpolation of the escape sequence (e.g.,\n\
+\"\\\\n\") or use the @code{regexptranslate} function.\n\
 @seealso{regexp, regexpi, strrep}\n\
 @end deftypefn")
 {