<commit_before><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!--
  Javascript Experiment: Client-side input validation
  
  $Id$
-->
<html>
  <head>
    <title>Javascript Experiment: Input validation</title>
    <style type="text/css">
      .error        { background-color: #990000; color: white }
    </style>
    <script language="JavaScript">
      var validation= new Array(); {
        validation['date']  = /^([0-9]{1,2})\.([1-9]|10|11|12)\.([0-9]{4})$/;
        validation['email'] = /^[^@]+@[^.]+\.[a-z]{2,8}$/;
      }
      
      function handleKeyPress(object, e) {
        if (!validation[object.name]) return true; // Border case
        
        if (!object.value.match(validation[object.name])) {
          object.className= 'error';
        } else {
          object.className= '';
        }
        
        return true; // Indicate we processed this
      }
    </script><commit_msg>- Use a better regular expression for dates<commit_after><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!--
  Javascript Experiment: Client-side input validation
  
  $Id$
-->
<html>
  <head>
    <title>Javascript Experiment: Input validation</title>
    <style type="text/css">
      .error        { background-color: #990000; color: white }
    </style>
    <script language="JavaScript">
      var validation= new Array(); {
        validation['date']  = /^(0?[1-9]|[12][0-9]|3[01])\.(0?[1-9]|10|11|12)\.([0-9]{4})$/;
        validation['email'] = /^[^@]+@[^.]+\.[a-z]{2,8}$/;
      }
      
      function handleKeyPress(object, e) {
        if (!validation[object.name]) return true; // Border case
        
        if (!object.value.match(validation[object.name])) {
          object.className= 'error';
        } else {
          object.className= '';
        }
        
        return true; // Indicate we processed this
      }
    </script>
{'fraction_non_alphanumeric': 0.18984664198836596, 'fraction_numerical': 0.03225806451612903, 'mean_word_length': 2.23972602739726, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6870705', 'n_tokens_mistral': 646, 'n_tokens_neox': 597, 'n_words': 124}