E.g. here for MySQL, but it's the same for other connectors. The docs say that the regular expression is used to identify the key columns, but actually, the regular expression is used to match the table(s), whereas the corresponding key column(s) are given with their name.
See here for the actual semantics. Here's some valid examples: