# Example with alternating patterns and replacements
expr_replace({ 1 + 2 }, {1}, {one}, {2}, {two})
# Example with patterns and replacements in a list
expr_replace({ 1 + 2 }, patterns = expr_list({1}, {2}),
replacements = expr_list({one}, {two}))
# Replace with captures
expr_replace({ 1 + 2 }, ~{ .A + .B }, { .A - .B })
Run the code above in your browser using DataLab