how to add custom validation rules to civievent registration form
More straight-forward way is to write a simple validateForm hook - https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_validateForm/ into an extension.

If you are new to creating an extension, this might be a good place to start - https://docs.civicrm.org/dev/en/latest/extensions/civix/