shadiadiph Posted June 28, 2010 Share Posted June 28, 2010 Does a-z in regex validate european characters like French or German vowels that have the strange marks above them? Link to comment https://forums.phpfreaks.com/topic/206045-does-a-z-in-regex-validate-european-charachters/ Share on other sites More sharing options...
salathe Posted June 28, 2010 Share Posted June 28, 2010 No. Link to comment https://forums.phpfreaks.com/topic/206045-does-a-z-in-regex-validate-european-charachters/#findComment-1078116 Share on other sites More sharing options...
shadiadiph Posted June 28, 2010 Author Share Posted June 28, 2010 mm so how to get round this problem? how to validate european characters also? Link to comment https://forums.phpfreaks.com/topic/206045-does-a-z-in-regex-validate-european-charachters/#findComment-1078203 Share on other sites More sharing options...
shadiadiph Posted June 28, 2010 Author Share Posted June 28, 2010 or rather disallow characters $ % @ ! Link to comment https://forums.phpfreaks.com/topic/206045-does-a-z-in-regex-validate-european-charachters/#findComment-1078210 Share on other sites More sharing options...
cags Posted June 28, 2010 Share Posted June 28, 2010 You could simply ensure that the string doesn't contain those characters using [^$%@!] etc. Link to comment https://forums.phpfreaks.com/topic/206045-does-a-z-in-regex-validate-european-charachters/#findComment-1078215 Share on other sites More sharing options...
shadiadiph Posted June 28, 2010 Author Share Posted June 28, 2010 so how to check just for those characters? Link to comment https://forums.phpfreaks.com/topic/206045-does-a-z-in-regex-validate-european-charachters/#findComment-1078223 Share on other sites More sharing options...
shadiadiph Posted June 28, 2010 Author Share Posted June 28, 2010 just tried that /[^$%@!] / returns even the word dog as invalid if i check to see if the match is false seems to return everything as true Link to comment https://forums.phpfreaks.com/topic/206045-does-a-z-in-regex-validate-european-charachters/#findComment-1078246 Share on other sites More sharing options...
Alex Posted June 28, 2010 Share Posted June 28, 2010 if(!preg_match('~^[^$%@!]+$~', $str)) { // contains invalid characters } Link to comment https://forums.phpfreaks.com/topic/206045-does-a-z-in-regex-validate-european-charachters/#findComment-1078277 Share on other sites More sharing options...
shadiadiph Posted June 28, 2010 Author Share Posted June 28, 2010 thanks for the hint Alex but that will not work for me I just tried making it into a normal regex pattern couldn't get it to work. Trybing to actually do all my validation browser sided not server sided ?? Link to comment https://forums.phpfreaks.com/topic/206045-does-a-z-in-regex-validate-european-charachters/#findComment-1078295 Share on other sites More sharing options...
shadiadiph Posted June 28, 2010 Author Share Posted June 28, 2010 I just tried it like this but didn;t work var cityreg=/^[^$%@!]+$/; Link to comment https://forums.phpfreaks.com/topic/206045-does-a-z-in-regex-validate-european-charachters/#findComment-1078297 Share on other sites More sharing options...
Psycho Posted June 28, 2010 Share Posted June 28, 2010 <html> <head> <script type="text/javascript"> function invalidInput(text) { var invalidChars = /[$%@!]/ return invalidChars.test(text); } function checkInput() { var inputText = document.getElementById('input').value; if(invalidInput(inputText)) { alert('Input was NOT valid'); } else { alert('Input was valid'); } return; } </script> </head> <body> Input: <input type="text" name="input" id="input" /> <br /> <button onclick="checkInput();">Test</button> </body> </html> Link to comment https://forums.phpfreaks.com/topic/206045-does-a-z-in-regex-validate-european-charachters/#findComment-1078324 Share on other sites More sharing options...
shadiadiph Posted June 29, 2010 Author Share Posted June 29, 2010 Thanks mjdamato and everyone else who contributed. Link to comment https://forums.phpfreaks.com/topic/206045-does-a-z-in-regex-validate-european-charachters/#findComment-1078627 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.