Pro forms database username validation

Hi guys, does anyone know how I can set up a code for validating the username through the database? I know we got Regex validation but that is not enough i want the form to also be able to validate through the database to check if the username exists. Is there any way to do that?