How to use expressions in rules?
Firefly III v6.1.20
This feature is enabled in Firefly III v6.1.20 and later
Introduction
Once you've learned how to use rules, you may think that rule actions are pretty plain. You can update some fields, but it's all pretty static. That's where expressions come in.
Thanks to GitHub user @michaelhthomas the rule actions now support the Symfony expression engine. This means that you can write a complicate "expression" that result in a new piece of text, or a new value. Depending on the action that you choose, you can do some pretty cool things.
Full syntax
The full syntax of the expression language is documented in the Symfony documentation.
You can read about the fields you can use in the expression reference.
Basics
First the basics. A rule action contains a value, and the value will be set in the transaction. Here's an example. It does not use the expression engine:

This rule action will set the category of the transaction to "Groceries". This is pretty straightforward.
An expression starts with =. This tells Firefly III that you're about to write an expression. The expression follows.
Here's a simple example that sets the notes of the transaction to whatever the description is.

=description
Mathematics
You can use some simple mathematics, for example on the amount-field, to subtract taxes or fees. Here's an action to remove Dutch sales tax from a transaction, which is 21% in most cases:

=amount-(amount/121)*21
Text
You can join strings together using the tilde. This allows you to join two fields together, or add a prefix or suffix to a field. Here is the description added to the notes twice.

=description~description
Substrings and string length
You can use strlen to get the length of a value, and you can use substr to cut a part of a value out. For example, this would set the notes to however long the description is. And yes, the notes will say 6 if the description is six characters long. Not very useful, but you can see that this could be very powerful in other combinations.

=strlen(description)
This method example cuts of the last four characters of the description:

=substr(description, 0, -4)
This allows for more useful combinations. Some of my own transactions always end with the name of the destination account (so it's double). I can cut that off using:

substr(description, 0, strlen(description) - strlen(destination_name))
Other methods
There are no other methods yet, but they can be added. Are you looking for anything in particular? Let me know.