summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--doc/regsub.n13
2 files changed, 15 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 62187a0..86256c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-09-10 Donal K. Fellows <dkf@users.sf.net>
+
+ * doc/regsub.n: [Bug 3063568]: Fix for gotcha in example due to Tcl's
+ special handling of backslash-newline. Makes example slightly less
+ pure, but more useful.
+
2010-09-08 Andreas Kupries <andreask@activestate.com>
*** 8.5.9 TAGGED FOR RELEASE ***
@@ -11,7 +17,7 @@
* changes: Update for 8.5.9 release.
* win/tclWin32Dll.c: #ifdef protections to permit builds with
- * win/tclWinChan.c: mingw on amd64 systems. Thanks to "mescalinum"
+ * win/tclWinChan.c: mingw on amd64 systems. Thanks to "mescalinum"
* win/tclWinFCmd.c: for reporting and testing.
2010-09-06 Stuart Cassoff <stwo@users.sourceforge.net>
diff --git a/doc/regsub.n b/doc/regsub.n
index 413a6ab..e762b9d 100644
--- a/doc/regsub.n
+++ b/doc/regsub.n
@@ -6,7 +6,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: regsub.n,v 1.22.2.1 2008/07/07 08:36:30 dkf Exp $
+'\" RCS: @(#) $Id: regsub.n,v 1.22.2.2 2010/09/10 13:02:12 dkf Exp $
'\"
.so man.macros
.TH regsub n 8.3 Tcl "Tcl Built-In Commands"
@@ -161,15 +161,18 @@ Insert double-quotes around the first instance of the word
Convert all non-ASCII and Tcl-significant characters into \eu escape
sequences by using \fBregsub\fR and \fBsubst\fR in combination:
.CS
-# This RE is just a character class for everything "bad"
-set RE {[][{};#\e\e\e$\es\eu0080-\euffff]}
+# This RE is just a character class for almost everything "bad"
+set RE {[][{};#\e\e\e$ \er\et\eu0080-\euffff]}
# We will substitute with a fragment of Tcl script in brackets
set substitution {[format \e\e\e\eu%04x [scan "\e\e&" %c]]}
# Now we apply the substitution to get a subst-string that
-# will perform the computational parts of the conversion.
-set quoted [subst [\fBregsub\fR -all $RE $string $substitution]]
+# will perform the computational parts of the conversion. Note
+# that newline is handled specially through \fBstring map\fR since
+# backslash-newline is a special sequence.
+set quoted [subst [string map {\en {\e\eu000a}} \e
+ [\fBregsub\fR -all $RE $string $substitution]]]
.CE
.SH "SEE ALSO"
regexp(n), re_syntax(n), subst(n),