Merge commit '60617d819d77a1b92ed6c557a0b49b8e9a8e97b9'
[bpt/guile.git] / doc / ref / api-regex.texi
index 61410d9..082fb87 100644 (file)
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Guile Reference Manual.
-@c Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2007, 2009, 2010
+@c Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2007, 2009, 2010, 2012
 @c   Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
 
@@ -54,11 +54,12 @@ Zero bytes (@code{#\nul}) cannot be used in regex patterns or input
 strings, since the underlying C functions treat that as the end of
 string.  If there's a zero byte an error is thrown.
 
-Patterns and input strings are treated as being in the locale
-character set if @code{setlocale} has been called (@pxref{Locales}),
-and in a multibyte locale this includes treating multi-byte sequences
-as a single character.  (Guile strings are currently merely bytes,
-though this may change in the future, @xref{Conversion to/from C}.)
+Internally, patterns and input strings are converted to the current
+locale's encoding, and then passed to the C library's regular expression
+routines (@pxref{Regular Expressions,,, libc, The GNU C Library
+Reference Manual}).  The returned match structures always point to
+characters in the strings, not to individual bytes, even in the case of
+multi-byte encodings.
 
 @deffn {Scheme Procedure} string-match pattern str [start]
 Compile the string @var{pattern} into a regular expression and compare
@@ -228,7 +229,7 @@ and replace them with the contents of another string.  The following
 functions are convenient ways to do this.
 
 @c begin (scm-doc-string "regex.scm" "regexp-substitute")
-@deffn {Scheme Procedure} regexp-substitute port match [item@dots{}]
+@deffn {Scheme Procedure} regexp-substitute port match item @dots{}
 Write to @var{port} selected parts of the match structure @var{match}.
 Or if @var{port} is @code{#f} then form a string from those parts and
 return that.
@@ -276,7 +277,7 @@ re-ordering and hyphenating the fields.
 
 
 @c begin (scm-doc-string "regex.scm" "regexp-substitute")
-@deffn {Scheme Procedure} regexp-substitute/global port regexp target [item@dots{}]
+@deffn {Scheme Procedure} regexp-substitute/global port regexp target item@dots{}
 @cindex search and replace
 Write to @var{port} selected parts of matches of @var{regexp} in
 @var{target}.  If @var{port} is @code{#f} then form a string from
@@ -402,7 +403,7 @@ Return the ending position of submatch number @var{n}.
 @end deffn
 
 In the following example, the result is 8, since the match runs between
-characters 4 and 8 (i.e. the ``2002'').
+characters 4 and 8 (i.e.@: the ``2002'').
 
 @lisp
 (define s (string-match "[0-9][0-9][0-9][0-9]" "blah2002foo"))