[Templates-cvs] cvs commit: Template2/docsrc/src/Manual VMethods.tt2
cvs@template-toolkit.org
cvs@template-toolkit.org
cvs 06/02/01 16:21:09
Modified: docsrc/src/Manual VMethods.tt2
Log:
* documented global option to text.match
Revision Changes Path
1.10 +9 -1 Template2/docsrc/src/Manual/VMethods.tt2
Index: VMethods.tt2
===================================================================
RCS file: /template-toolkit/Template2/docsrc/src/Manual/VMethods.tt2,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- VMethods.tt2 2006/02/01 08:39:01 1.9
+++ VMethods.tt2 2006/02/01 16:21:08 1.10
@@ -45,7 +45,7 @@
[% name = 'foo, bar & baz' %]
[% name.remove('\W+') %] # foobarbaz
-=item match(pattern)
+=item match(pattern, global)
Performs a regular expression match on the string using the pattern
passed as an argument. If the pattern matches the string then the
@@ -79,6 +79,14 @@
(\w+)
';
matches = name.match(re);
+ %]
+
+To perform a global search to match the pattern as many times as it
+appears in the source string, provide a true value for the 'global'
+argument following the pattern.
+
+ [% text = 'bandanna';
+ text.match('an+', 1).join(', ) # an, ann
%]
=item search(pattern)