var newsname;
ctrl.checkNameLegal = function () {
if (ctrl.fileName) {
var exports = /^(?![.])[\u4e00-\u9fa5_.a-zA-Z0-9]+$/ig;
if (exports.test(ctrl.fileName)) {
newsname = ctrl.fileName;
} else {
ctrl.fileName = newsname;
}
} else {
newsname = "";
}
};
this is written in an abnormal way. Is there any way to replace it with
ctrl.fileName = ctrl.fileName.replace (/.. / ig,"");
Thank you, God!