comment puis-je pas laisser ces caractères:javascript expressions régulières
\/"[] {} | ~`^&
utilisant javascript modèle d'expression régulière
comment puis-je pas laisser ces caractères:javascript expressions régulières
\/"[] {} | ~`^&
utilisant javascript modèle d'expression régulière
Vérifier une chaîne contient l'un de ces caractères:
if(str.match(/[\\\/"'\[\]{}|~`^&]/)){
alert('not valid');
}
Validat chaîne entière ea, début à la fin:
if(str.match(/^[^\\\/"'\[\]{}|~`^&]*$/)){
alert('it is ok.');
}
Ou pour supprimer ces caractères: 'str = str.replace (/ [\\\ /" '\ [\] {} | ~ \ '^ &]/g," ");' – Anonymous
double possible de http://stackoverflow.com/questions/705672/regular-expression-to-allow-a-set-of-characters-and-disallow-others – outis
Aussi: http://stackoverflow.com/questions/756567/expression-expressive-pour-excluding-special-characters, http://stackoverflow.com/questions/1152844/regex-for-alphanumeric-and-the-character , http://stackoverflow.com/questions/1763071/negate-characters-in-regular-expression, http://stackoverflow.com/questions/834002/regular-expression-that-includes-all-keyboard-characters-except -et, ... – outis
Et (malgré les balises PHP): http://stackoverflow.com/questions/1778958/php-regular-expression-accept-selected-characters-only, http://stackoverflow.com/questions/ 878715/check-string-for-illegal-characters-using-reg ular-expression. – outis