How to check schema fields against a regex?

I want to restrict the usernames in my user table with a regex. Basically instagram like criteria for usernames.
This is my current schema:
username: varchar('username', { length: 128 }).unique().notNull(),

Is there any method that I can call on this to restrict the username? Something like this:
username: varchar('username', { length: 64 }).unique().notNull()./^(?!.*\.\.)(?!.*\.$)[^\W][\w.]{0,64}$/igm.test(email),

I know that's nonsense code above, but I'm just trying to convey myself. please don't mind 😅
Was this page helpful?