0
function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
          return;
    }
  g_form.hideErrorBox('user_email');
       var pattern =/^[a-zA-Z0-9]*$/;   // regex pattern
   if(!pattern.test(newValue)){
     g_form.showErrorBox('user_email', getMessage('Alphanumeric without space allowed'));//show error messege
           g_form.setValue('user_email', '');
   }
}
Regex Validation only Alphanumeric without space allowed ServiceNow
Working Code Edited question July 24, 2023