This article will help you add your own validation rule in Magento 2. Below are the steps which will help you to add a custom validation rule inside your module. Create a new js file.
Register new js file.
Apply newly created rule to the form fields.
Clear cache and check the form.