And i can't see anyway of doing it on the fly in an oledb sql statement (which would have been better)
The way it's implemented in ARM is that the client sends up a regex match, e.g. "[stu][ghi][abc][lmn][ghi]", and the server takes the first 3 groups and generates the 27* different prefixes, and then asks the database for matching items (it hits the database 27 times). From these results, it applies the rest of the regex to get the final results.
* except it's more than 27, because each group in the regex has the number in it as well.
Then all you need is a table which tells you, for each device, which letters are on which button.