I think I've a problem with regular expression: I want a string wich can contains all the characthers in the first rounded parenthesis and eventually a [ and finally a ]. the regex is the following:
var pattern = /^(([a-zA-Z0-9\.\_\-\(\)\\'\xE0\xE8\xE9\xF9\xF2\xEC\x27\,\/]\s?)*\[?([a-zA-Z0-9\.\_\-\(\)\\'\xE0\xE8\xE9\xF9\xF2\xEC\x27\,\/]\s?)*\]?)+$/;
the problem is that if I try to test the following string Maionese [dfvdfv]@ my program will loop forever :-|
the function that I use to test is the following:
//the alert doesn't works
alert(checkSpecialIngredienti("Maionese [dfvdfv]@"));
function checkSpecialIngredienti(s) {
var pattern = /^(([a-zA-Z0-9\.\_\-\(\)\\'\xE0\xE8\xE9\xF9\xF2\xEC\x27\,\/]\s?)*\[?([a-zA-Z0-9\.\_\-\(\)\\'\xE0\xE8\xE9\xF9\xF2\xEC\x27\,\/]\s?)*\]?)+$/;
if (!pattern.test(s)) {
alert("Attenzione, il campo "+s+"" +
" che hai inserito non va bene!" +
"\nIn questo campo puoi inserire " +
"lettere, numeri, lettere accentate," +
"punteggiatura classica, singoli spazi e" +
"\nuna sola coppia di parentesi quadre." +
"\nRiprova!");
return (false);
} else
return true;
}