Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Primary Navigation

    • Cloud & Deployment
    • Core Language & Structure
    • Data Manipulation & Analysis
    • Engineering Data & Computation
    • External Interfaces & Connections
    • Financial Data & Computation
    • Geographic Data & Computation
    • Geometry
    • Graphs & Networks
    • Higher Mathematical Computation
    • Images
    • Knowledge Representation & Natural Language
    • Machine Learning
    • Notebook Documents & Presentation
    • Scientific and Medical Data & Computation
    • Social, Cultural & Linguistic Data
    • Strings & Text
    • Symbolic & Numeric Computation
    • System Operation & Setup
    • Time-Related Computation
    • User Interface Construction
    • Visualization & Graphics
    • Random Paclet
    • Alphabetical List
  • Using Paclets
    • Get Started
    • Download Definition Notebook
  • Learn More about Wolfram Language

PatternMatcher

Guides

  • A Virtual Machine for the Pattern Matcher

Symbols

  • CompilePatternToBytecode
  • CreatePatternMatcherVirtualMachine
  • PatternBytecodeDisassemble
  • PatternBytecodeInformation
  • PatternBytecode
  • PatternBytecodeQ
  • PatternMatcherEnableTrace
  • PatternMatcherExecute
  • PatternMatcherMatch
  • PatternMatcherMatchQ
  • PatternMatcherReplace
  • PatternMatcherStep
  • PatternMatcherTraceEnabled
  • PatternMatcherTraceEnabledQ
  • PatternMatcherVirtualMachine
  • PatternToMatchFunction
DanielS`PatternMatcher`
PatternMatcherMatchQ
​
PatternMatcherMatchQ
[vm,expr]
returns
True
if
expr
matches the pattern in the virtual machine
vm
, and
False
otherwise.
​
​
PatternMatcherMatchQ
[patt,expr]
automatically compiles
patt
to bytecode, creates a virtual machine, and tests if
expr
matches.
​
​
PatternMatcherMatchQ
[form]
is an operator form that can be applied to expressions.
​
Details and Options
Examples  
(5)
Basic Examples  
(2)
Match a simple literal pattern:
In[1]:=
PatternMatcherMatchQ
[5,5]
Out[1]=
True
Match a pattern with a blank:
In[2]:=
PatternMatcherMatchQ
[42,_Integer]
Out[2]=
True
Match a pattern with a named variable:
In[3]:=
PatternMatcherMatchQ
[{5,5},{x_,x_}]
Out[3]=
True
Match fails when elements differ:
In[4]:=
PatternMatcherMatchQ
[{5,10},{x_,x_}]
Out[4]=
False
Match with head constraints:
In[5]:=
PatternMatcherMatchQ
[f[42,"hello"],f[_Integer,_String]]
Out[5]=
True
Match using alternatives in the pattern:
In[6]:=
PatternMatcherMatchQ
[314,x_Integer|x_Real]
Out[6]=
True
In[7]:=
PatternMatcherMatchQ
[3.14,x_Integer|x_Real]
Out[7]=
True
​
PatternMatcherMatchQ
has an operator form:
In[1]:=
PatternMatcherMatchQ
[f[_Integer,_String]][f[42,"hello"]]
Out[1]=
True
Scope  
(2)

Properties & Relations  
(1)

SeeAlso
PatternMatcherVirtualMachine
 
▪
PatternBytecode
 
▪
PatternMatcherExecute
 
▪
PatternMatcherReplace
 
▪
CreatePatternMatcherVirtualMachine
 
▪
CompilePatternToBytecode
 
▪
PatternMatcherEnableTrace
 
▪
PatternMatcherTraceEnabledQ
RelatedGuides
▪
A Virtual Machine for the Pattern Matcher
""

© 2026 Wolfram. All rights reserved.

  • Legal & Privacy Policy
  • Contact Us
  • WolframAlpha.com
  • WolframCloud.com