Trailing separators

fn main() { macro_rules! match_exprs { ($($exprs:expr),* $(,)*) => {...}; } }
macro_rules! match_exprs {
    ($($exprs:expr),* $(,)*) => {...};

There are various places in the Rust grammar where trailing commas are permitted. The two common ways of matching (for example) a list of expressions ($($exprs:expr),* and $($exprs:expr,)*) can deal with either no trailing comma or a trailing comma, but not both.

Placing a $(,)* repetition after the main list, however, will capture any number (including zero or one) of trailing commas, or any other separator you may be using.

Note that this cannot be used in all contexts. If the compiler rejects this, you will likely need to use multiple arms and/or incremental matching.