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

StringMatchQ

Usage
Notes
Further Examples

This string matches the pattern "b*c*", which means the letter b followed by zero or more characters followed by the letter c followed by zero or more characters.

In[1]:=  

Out[1]=

Here is the same pattern using the string expression operator.

In[2]:=  

Out[2]=

This checks that the string contains only "a", "c", "g", and "t" characters (a DNA sequence).

In[3]:=  

Out[3]=

Here is the RegularExpression equivalent.

In[4]:=  

Out[4]=

The default option value of IgnoreCase is False.

In[5]:=  

Out[5]=

In[6]:=  

Out[6]=

With  , upper and lower case are treated the same.

In[7]:=  

Out[7]=

Verbatim can be used to match against patterns involving the metacharacters "*" and "@".

In[8]:=  

Out[8]=

In[9]:=  

Out[9]=

These strings do not match.

In[10]:=  

Out[10]=

Allowing for spelling correction, the words commit and comit are close enough to match, but commit and comite are not.

In[11]:=  

Out[11]=

In[12]:=  

Out[12]=

Here is a list of strings and a list of patterns.

In[13]:=  

In[14]:=  

StringMatchQ gives True only for strings that contain at least one of the substrings "Al", "gene", or "rot".

In[15]:=  

Out[15]=

The words Alexander, Dorothy and Eugene are not selected when we pick out the names that are not matched.

In[16]:=  

Out[16]=

In[17]:=  


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: