Music patterns

A pattern may contain literal bell symbols or wildcards that can match various bells. Three forms of wildcard are supported: a ? represents any single bell, a * represents any number (including zero) arbitrary bells, and [list] matches exactly one bell from the list of symbols.

For example, on eight bells, ????5678 matches a roll-up at the back; this can be written more succinctly as *5678. A combination roll-up (CRU) on eight has two of 4, 5 and 6 rolling-up followed by 78. It can be written *[456][456]78.

If a pattern is shorter than the row and contains no * to match the surplus bells, then it matches at the start of the row. For example, 5678 matches the row 56781234 but not 12345678. To match a sequence of bells at any place in the row, place a * on both sides of the pattern: *5678*.

Named music patterns

There is also a shorthand notation for matching particular commonly requested patterns such as queens, CRUs, or four-bell runs. This is written <name>. At present, the following named patterns are supported.

The bells in order; e.g. 1234567 on seven bells.
The odd bells in order, followed by the even bells in order; e.g. 1357246 on seven bells.
The odd bells in reverse, followed by the even bells in order; e.g. 7531246 on seven bells.
The front bells in sequence, alternating with the back bells in order; e.g. 1526374 on seven bells.
The bells in reverse order; e.g. 7654321 on seven bells.
Any four bells, followed by two of 4, 5 or 6, followed by the back bells in order.
A run of n bells in sequence (forwards or backwards) off the front of the row.
A run of n bells in sequence (forwards or backwards) at the back of the row.
A run of n bells in sequence (forwards or backwards) at an arbitrary position in the row.

With the n-runs named pattern, it is possible for a row to match the pattern more than once. For example, the row 32145678 matches <4-runs> twice because it has a five-bell run and both of its constituent four-bell runs (4567 and 5678) match. This means a longer run scores more than a shorter run.

Note that the names of these patterns are case-sensitive.