[Swift-commit] r4705 - trunk/docs/userguide

jonmon at ci.uchicago.edu jonmon at ci.uchicago.edu
Wed Jun 29 09:49:14 CDT 2011


Author: jonmon
Date: 2011-06-29 09:49:14 -0500 (Wed, 29 Jun 2011)
New Revision: 4705

Modified:
   trunk/docs/userguide/mappers
Log:
o added documentation for the structured regular expression mapper


Modified: trunk/docs/userguide/mappers
===================================================================
--- trunk/docs/userguide/mappers	2011-06-29 14:06:02 UTC (rev 4704)
+++ trunk/docs/userguide/mappers	2011-06-29 14:49:14 UTC (rev 4705)
@@ -646,7 +646,36 @@
 |f|picture.jpg
 |=============
 
+structured regular expression mapper
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+The structured_regexp_mapper is similar to the regexp_mapper. The
+structured_regexp_mapper can be applied to lists while the regexp_mapper cannot.
 
+[options="header, autowidth"]
+|==========
+|parameter|meaning
+|source|The source file name
+|match|Regular expression pattern to match, use |()| to match whatever
+regular expression is inside the parentheses, and indicate the start and
+end of a group; the contents of a group can be retrieved with the
+|\\number|special sequence (two backslashes are needed because the
+backslash is an escape sequence introducer)
+|transform|The pattern of the file name to transform to, use \number to
+reference the group matched.
+|==========
+
+Example:
+----
+string s[] = ["picture.gif", "hello.gif", "world.gif"];
+file f[] <structured_regexp_mapper;
+          source=s,
+          match="(.*)gif",
+          transform="\\1jpg">;
+----
+
+This example transforms all strings in a list that end in gif to end in jpg and maps
+the list to those files.
+
 csv mapper
 ~~~~~~~~~~
 The csv_mapper maps the content of a CSV (comma-separated value) file




More information about the Swift-commit mailing list