function stat() {
  var s = new RegExp(document.form1.regl.value);
  var x, t=0, p=0, l=pi.length;
  document.form1.occ.value="";
  pi2=pi;
  while(true) {
    pi2 = pi2.slice(p,pi2.length);
    x= pi2.search(s);
    if(x != -1) {
      t++;
      p = x+1;
    } else break;
  }
  document.form1.occ.value=t;
}

function exemple(n) {
var exos = new Array(
"[0-4]{5}[5-9]{3}", // 0
"123", // 1
"[123]", // 2
"43210", //3
"5656", // 4
"010101", // 5
"[02468]", // 6 pairs
"[13579]", // 7 impairs
"[02468]{2}", // 8 deux pairs
"[02468]{2}[13579]{2}", // 9 deux pairs pui deux impairs
"0{2,}", // 10 au moins deux zéros
"1{2,4}", // 11
"1+2+3+", // 12
"0[^0]+0" // 13
);
document.form1.regl.value=exos[n];
stat();
}

