StringCases
Usage
Notes
Further Examples
This picks out substrings consisting of an "a" followed by any character.
In[1]:=
|
Out[1]=
|
This does the same thing.
In[2]:=
|
Out[2]=
|
This returns only the character following the "a".
In[3]:=
|
Out[3]=
|
This does the same thing.
In[4]:=
|
Out[4]=
|
This picks out words that do not contain "t".
In[5]:=
|
Out[5]=
|
This picks out words with double letters.
In[6]:=
|
Out[6]=
|
This does the same thing.
In[7]:=
|
Out[7]=
|
This gives the list of substrings starting with "a" and ending with "t". Overlaps are not included by default.
In[8]:=
|
Out[8]=
|
With overlaps, many more substrings are found.
In[9]:=
|
Out[9]=
|
Using , even multiple substrings starting at the same position are included.
In[10]:=
|
Out[10]=
|
To get the shortest substrings use ShortestMatch.
In[11]:=
|
Out[11]=
|
This splits a list of phone numbers into their individual parts.
In[12]:=
|
Out[12]=
|
This does the same thing.
In[13]:=
|
Out[13]=
|
For efficiency a list can be used as the first argument of StringCases. This picks out numbers with at least two identical digits.
In[14]:=
|
Out[14]=
|
|