Здесь у меня есть одно изображение, это imageName только точки (...............jpg
) Я получил imageName только с точками (imageNameWithoutExtension
см. Косоль), если imageName имеет только точки, поэтому я хочу регулярное выражение только точки, поэтому я могу сравнить только с точкамиregex с точками с именем imageName, как получить точки regex?
renameFile.component.ts
updateFileName(){
console.log(imageName); // ...............jpg
var imageArray = imageName.split('.');
var imageExtension = imageArray.pop();
var imageNameWithoutExtension = imageArray.join('.');
console.log(imageNameWithoutExtension); // ...............
imageNameWithoutExtension.replace(^([,.\d]+)([,.]\d{2})$); i tried this but it gives error, how to use regex or make regex I dont know
'image name with only dots' // hot to get regex of only dots
if(imageNameWithoutExtension == 'image name with only dots'){
console.log("image name with only dots so not allowed to rename");
}else{
console.log("image name with not only dots so allow to rename");
}
}