Which is the correct preposition to use with the verb "match"? [closed]

In my understanding, both are valid, but they mean different things.

To match A with B means to consider the pair (A, B) a set, or to purposely place them together:

In the seating arrangements, I matched John with Cynthia and boy, did they have a spirited discussion.

I matched the hyacinths with the zinnias. Don't they look great together?

To match A to B means to find some B that corresponds to the relevant aspect of A:

To locate the invoice for this order, you have to match the primary key of table ORDER to the foreign key of table INVOICE.

In order for the room to look its best, you have to match the sofa to the carpet.