<commit_before>//$(document).ready(function() {

  /**
   * Clear the "textArea"
   */
  $('.job-clear-btn').click(function(){
    $('.job-clear-btn').blur();
    $('#code').val('');
    $('#title').val('');
    $('#description').val('');
    $('#message').html('');
    $('.error').hide();
    $('.loading').hide();
  });

  loadJobs();
  
  /**
   * 1. Create the request
   * 2. Call the API
   * 3. Call the methods to display the results
   */
  $('.job-add-btn').click(function(){
    $('.job-add-btn').blur();
    $('.loading').show();
    $('.error').hide();
    $('#message').html('');
    
    var $input = {
        code: $('#code').val(),
        title: $('#title').val(),
        description: $('#description').val().replace(/(\n)+/g, ' ')
      };

    //$('#message').html(JSON.stringify($input));

    // TODO alanbra: not working b/c always returning error
    $.ajax({
      type: 'PUT',
      data: $input,
      url: '/job',
      dataType: 'json',
      success: function(data) {
        $('.loading').hide();

        $('#message').html( $input.code + ' added.');
        loadJobs(); 

      },
      error: function(error) {
        $('.loading').hide();
        console.log('Error: ' + JSON.stringify(error) + '\n' + JSON.stringify($input) );
        showError(error.error || error);
      }
    });

  }); //click

  function loadJobs() {
    var j = getJobs();
    j.forEach(function(job) {
      $('<li><a href=\'/job/'+job+'\' target=\'_blank\'>'+job+'</a></li>').appendTo($('#jobs-list'));
    });
    $('#num-jobs').html(j.length + ' jobs');
	j.forEach(function(job) {<commit_msg>fixed regex;<commit_after>//$(document).ready(function() {

  /**
   * Clear the "textArea"
   */
  $('.job-clear-btn').click(function(){
    $('.job-clear-btn').blur();
    $('#code').val('');
    $('#title').val('');
    $('#description').val('');
    $('#message').html('');
    $('.error').hide();
    $('.loading').hide();
  });

  loadJobs();
  
  /**
   * 1. Create the request
   * 2. Call the API
   * 3. Call the methods to display the results
   */
  $('.job-add-btn').click(function(){
    $('.job-add-btn').blur();
    $('.loading').show();
    $('.error').hide();
    $('#message').html('');
    
    var $input = {
        code: $('#code').val(),
        title: $('#title').val(),
        description: $('#description').val().replace(/(\r\n|\n|\r)/gm," ")
      };
    //console.log(JSON.stringify($input.description));

    //$('#message').html(JSON.stringify($input));

    // TODO alanbra: not working b/c always returning error
    $.ajax({
      type: 'PUT',
      data: $input,
      url: '/job',
      dataType: 'json',
      success: function(data) {
        $('.loading').hide();
        $('#message').html( $input.code + ' added.');
        loadJobs(); 

      },
      error: function(error) {
        $('.loading').hide();
        console.log('Error: ' + JSON.stringify(error) + '\n' + JSON.stringify($input) );
        showError(error.error || error);
      }
    });

  }); //click

  function loadJobs() {
    var j = getJobs();
    j.forEach(function(job) {
      $('<li><a href=\'/job/'+job+'\' target=\'_blank\'>'+job+'</a></li>').appendTo($('#jobs-list'));
    });
    $('#num-jobs').html(j.length + ' jobs');
	j.forEach(function(job) {
{'fraction_non_alphanumeric': 0.27439024390243905, 'fraction_numerical': 0.001829268292682927, 'mean_word_length': 2.421272158498436, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '6766878', 'n_tokens_mistral': 1096, 'n_tokens_neox': 1080, 'n_words': 180}