var regex = /^[A-Za-z0-9_ -]{1,1024}$/;
if (!regex.test(fName)) {
msg = 'The file name contains illegal characters\n
Please re-name the file using only alphanumeric characters, hyphens, spaces and underscores\n';
}
<script type="text/javascript">
var regex = /^[A-Za-z0-9_ -]{1,1024}$/;
if (!regex.test(fName)) {
msg = 'The file name contains illegal characters\n
Please re-name the file using only alphanumeric characters, hyphens, spaces and underscores\n';
}
</script>