Making a column only allow letters and characters, including capitals

I am using Yup for my validation on the client side. For example the username field does this:

.matches(/^[a-zA-Z0-9]*$/, 'Username can only contain letters and numbers')


My user schema on the drizzle side is:

username: varchar('username', { length: 20 }).unique().notNull(),


Just wondering is there a way to add the regex to it? Thanks
Was this page helpful?