sethupathy Posted June 20, 2007 Share Posted June 20, 2007 this is my code and it wont accept french caracter like é à l' can someone help pls function isAlphabet(elem, helperMsg){ var alphaExp = /^[a-zA-Z ]+$/; if(elem.value.match(alphaExp)){ return true; }else{ alert(helperMsg); elem.focus(); return false; Link to comment https://forums.phpfreaks.com/topic/56377-solved-french-characters/ Share on other sites More sharing options...
Wuhtzu Posted June 20, 2007 Share Posted June 20, 2007 Just add all the special french chars to your regex: /^[a-zA-ZéÉàÀ]+$/ Link to comment https://forums.phpfreaks.com/topic/56377-solved-french-characters/#findComment-278474 Share on other sites More sharing options...
sethupathy Posted June 20, 2007 Author Share Posted June 20, 2007 i did what you said and i added some more like ' and - " and it does not work /^[a-zA-ZéÉàÀ'-" ]+$/ is there another way to add ' - " Link to comment https://forums.phpfreaks.com/topic/56377-solved-french-characters/#findComment-278616 Share on other sites More sharing options...
Wuhtzu Posted June 20, 2007 Share Posted June 20, 2007 The - (minus) should always be the last character in a set of characters in a regex because it is used to define ranges... eg. a-z 0-9 but when you do this '-" it yields error because no range between ' and " exists. So do this: /^[a-zA-ZéÉàÀ'"-]+$/ Link to comment https://forums.phpfreaks.com/topic/56377-solved-french-characters/#findComment-278673 Share on other sites More sharing options...
sethupathy Posted June 21, 2007 Author Share Posted June 21, 2007 great thank you very much guys problem solved Link to comment https://forums.phpfreaks.com/topic/56377-solved-french-characters/#findComment-278928 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.