rem: yaml = yaml.replace(new RegExp('^','mg'),' '); 
add: yaml = yaml.replace(new RegExp('^(.)','mg'),' $1'); 
context: document.load_val_hash = function (form, val_hash) {  // check the form we are using  if (! form) return alert('Missing form or form name');  if (typeof(form) == 'string') {    if (! document[form]) return alert('No form by name '+form);    form = document[form];  }  // if we already have validation - use it  if (form.val_hash) return form.val_hash;  // load in the validation and save it for future use  if (typeof(val_hash) != 'object') {    // get the hash from a javascript function    if (typeof(val_hash) == 'function') {      val_hash = val_hash(formname);    } else if (typeof(val_hash) == 'undefined') {      var el;      // get hash from a global js variable      if (typeof(document.validation) != 'undefined') {        val_hash = document.validation;      // get hash from a element by if of validation      } else if (el = document.getElementById('validation')) {        val_hash = el.innerHTML;        val_hash = val_hash.replace(new RegExp('&lt;', 'ig'),'<');        val_hash = val_hash.replace(new RegExp('&gt;', 'ig'),'>');        val_hash = val_hash.replace(new RegExp('&amp;','ig'),'&');      // read hash from <input name=foo validation="">      } else {        var order = new Array();        var str   = '';        var yaml  = form.getAttribute('validation');        if (yaml) {          if (m = yaml.match('^( +)')) yaml = yaml.replace(new RegExp('^'+m[1], 'g'), ''); //unindent          yaml = yaml.replace(new RegExp('\\s*$',''),'\n'); // add trailing          str += yaml;        }        var m;        for (var i = 0; i < form.elements.length; i ++) {          var name = form.elements[i].name;          var yaml = form.elements[i].getAttribute('validation');          if (! name || ! yaml) continue;          yaml = yaml.replace(new RegExp('\\s*$',''),'\n'); // add trailing          yaml = yaml.replace(new RegExp('^','mg'),' ');    // indent all          yaml = yaml.replace(new RegExp('^( *[^\\s&*\\[\\{])',''),'\n$1'); // add newline          str += name +':' + yaml;          order[order.length] = name;        }        if (str) val_hash = str + "group order: [" + order.join(', ') + "]\n";      }    }    if (typeof(val_hash) == 'string') {      if (! document.yaml_load) return;      document.hide_yaml_errors = (! document.show_yaml_errors);      if (location.search && location.search.indexOf('show_yaml_errors') != -1)        document.hide_yaml_errors = 0;      val_hash = document.yaml_load(val_hash);      if (document.yaml_error_occured) return;    }  }  // attach to the form  form.val_hash = val_hash;  return form.val_hash;}
meta: 5443	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/5443/43e2c1b48fffb2b6fa653b7f23845f98265f67b0/validate.js/clean/lib/CGI/Ex/validate.js