var str = 'this string can contain nothing else but digits, spaces,'+
'commas and alphabetic characters';
alert(String(str.match(/[a-z\,\.\s0-9]/ig).length === str.length));
//returns trueThe set [a-z\,\.\s0-9] contains spaces, letters (case insensitive), digits, dots and comma's. Matching the set to a string that only contains characters from the set should deliver a resulting array with exactly the length of the input string. And yes, it does.
Why didn't I think of that before? Well ehr....
Geen opmerkingen:
Een reactie posten