Wolfram Language
Paclet Repository
Community-contributed installable additions to the Wolfram Language
Primary Navigation
Categories
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
Create a Paclet
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`
P
a
t
t
e
r
n
M
a
t
c
h
e
r
R
e
p
l
a
c
e
P
a
t
t
e
r
n
M
a
t
c
h
e
r
R
e
p
l
a
c
e
[
e
x
p
r
,
l
h
s
r
h
s
]
r
e
p
l
a
c
e
s
p
a
r
t
s
o
f
e
x
p
r
t
h
a
t
m
a
t
c
h
t
h
e
p
a
t
t
e
r
n
l
h
s
w
i
t
h
r
h
s
.
P
a
t
t
e
r
n
M
a
t
c
h
e
r
R
e
p
l
a
c
e
[
e
x
p
r
,
l
h
s
r
h
s
]
u
s
e
s
R
u
l
e
D
e
l
a
y
e
d
,
e
v
a
l
u
a
t
i
n
g
r
h
s
o
n
l
y
a
f
t
e
r
b
i
n
d
i
n
g
p
a
t
t
e
r
n
v
a
r
i
a
b
l
e
s
.
P
a
t
t
e
r
n
M
a
t
c
h
e
r
R
e
p
l
a
c
e
[
r
u
l
e
]
i
s
a
n
o
p
e
r
a
t
o
r
f
o
r
m
t
h
a
t
c
a
n
b
e
a
p
p
l
i
e
d
t
o
e
x
p
r
e
s
s
i
o
n
s
.
D
e
t
a
i
l
s
a
n
d
O
p
t
i
o
n
s
Examples
(
4
)
Basic Examples
(
2
)
Replace a literal value:
I
n
[
1
]
:
=
P
a
t
t
e
r
n
M
a
t
c
h
e
r
R
e
p
l
a
c
e
[
5
,
5
"
f
i
v
e
"
]
O
u
t
[
1
]
=
f
i
v
e
Replace using a blank pattern:
I
n
[
2
]
:
=
P
a
t
t
e
r
n
M
a
t
c
h
e
r
R
e
p
l
a
c
e
[
4
2
,
_
I
n
t
e
g
e
r
"
n
u
m
b
e
r
"
]
O
u
t
[
2
]
=
n
u
m
b
e
r
Replace using a named pattern variable:
I
n
[
3
]
:
=
P
a
t
t
e
r
n
M
a
t
c
h
e
r
R
e
p
l
a
c
e
[
"
h
e
l
l
o
"
,
x
_
{
x
,
x
}
]
O
u
t
[
3
]
=
{
h
e
l
l
o
,
h
e
l
l
o
}
Replace using pattern variables:
I
n
[
4
]
:
=
P
a
t
t
e
r
n
M
a
t
c
h
e
r
R
e
p
l
a
c
e
[
f
[
1
,
2
]
,
f
[
x
_
,
y
_
]
{
x
,
y
}
]
O
u
t
[
4
]
=
{
1
,
2
}
No replacement when pattern doesn't match:
I
n
[
5
]
:
=
P
a
t
t
e
r
n
M
a
t
c
h
e
r
R
e
p
l
a
c
e
[
f
[
1
,
2
,
3
]
,
f
[
x
_
,
y
_
]
{
x
,
y
}
]
O
u
t
[
5
]
=
f
[
1
,
2
,
3
]
Replace using a pattern with alternatives:
I
n
[
6
]
:
=
P
a
t
t
e
r
n
M
a
t
c
h
e
r
R
e
p
l
a
c
e
[
f
[
5
]
,
f
[
x
_
I
n
t
e
g
e
r
|
x
_
R
e
a
l
]
{
x
}
]
O
u
t
[
6
]
=
{
5
}
Replace using a pattern with condition:
I
n
[
7
]
:
=
P
a
t
t
e
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