a wobreturns="first"
The default. Match against the first occurance of the _subject pattern in a_string.
Here we let returns default to "first". Even though there are two subsstrings of
the input string that match our pattern, "barhey" and "foohey", only the first of them
is even attempted to match because returns="first".
Our returned string segment matches the pattern "barhey" and thus has "barhey"
as its
a_string value.
There is just one named subpattern to this pattern, named "fb" that matches "bar".
That sub-string_segment is named after the subpattern that it mateches, namely "fb".
(It could have also mathed "foo".)
The top level string_segment when using returns="first" ( or "last") is always named
"inner_whole". ("outer_whole" is used for returns="all".)
<pattern pattern.<named "fb" <one_of "foo" "bar"/>/> "hey"/>.
<get_string_segments "barheyjunkfoohey"/> | <string_segment name="inner_whole" start=0 end=6 a_string="barhey" <string_segment name="fb" start=0 end=3 a_string="bar"/>/>
|
a wobreturns="all"
Returns an "inner_whole" named string_segment for each occurance of the _subject pattern.
These are 'sub' string_segments of string_segment named "outer_whole" that
represents the entire input string.
<pattern pattern.<named "fb" <one_of "foo" "bar"/>/>
pattern.<named "what_the_hey" "hey"/>/>.
<get_string_segments "barheyjunkfooheytrashbar" returns="all"/> | <string_segment name="outer_whole" start=0 end=24 a_string="barheyjunkfooheytrashbar" <string_segment name="inner_whole" start=0 end=6 a_string="barhey"
<string_segment name="fb" start=0 end=3 a_string="bar"/>
<string_segment name="what_the_hey" start=3 end=6 a_string="hey"/>
/> <string_segment name="inner_whole" start=10 end=16 a_string="foohey"
<string_segment name="fb" start=10 end=13 a_string="foo"/>
<string_segment name="what_the_hey" start=13 end=16 a_string="hey"/>
/>/>
|
Note that the named patterns to match must be
immediate sub-patterns of the _subject pattern.
© Copyright 2007 Clear Methods, Inc.