In the regular expression, \d is shorthand for [0-9], which means any digit. {4} limits to maximum 4 characters.
Depending on your requirements, you can put together a regular expression using one of the following:
[A-Z0-9] - uppercase alphanumberic
[A-Za-z0-9] - alphanumberic
So if you want 4 alphanumeric characters, you can use [A-Za-z0-9]{4}
NOTE: I haven’t tested this but it should work!
I found info on this and the shorthand codes here: Regexp Tutorial - Shorthand Character Classes
Also you can refer to this guide for details of custom keyboards: