Wolfram ResearchPRODUCTSPURCHASEFOR USERSCOMPANYOUR SITES
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.

The Overlaps Option

The Overlaps option for StringCases, StringPosition, and StringCount deals with how the matcher proceeds after finding a match. It has three possible settings: False, True, or All. The default is False for StringCases and StringCount, while it is True for StringPosition.

With Overlaps->False, the matcher continues the match testing at the character following the last matched substring.

In[60]:= 

Out[60]=

With Overlaps->True, the matcher continues at the character following the first character of the last matched substring (when a single pattern is involved).

In[61]:= 

Out[61]=

With Overlaps->All, the matcher keeps starting at the same position until no more new matches are found.

In[62]:= 

Out[62]=

If multiple patterns are given in a list, Overlaps->True will cause the matcher to start at the same position once for each of the patterns before proceeding to the next character.

In[63]:= 

Out[63]=

In[64]:= 

Out[64]=

Note that with Overlaps->True, there can thus be a difference between specifying a list of patterns and using the alternatives operator (|).

In[65]:= 

Out[65]=

In[66]:= 

Out[66]=


Any questions about topics on this page? Click here to get an individual response.Buy NowFree TrialMore Information



 © 2009 Wolfram Research, Inc.  Terms of Use  Privacy Policy |
Sign up for our newsletter: