SOURCE




const url = "http://i0.hdslb.com/bfs/archive/34dd247c82c6597425891a626ec6aefd3047862e.jpg"

// 拿到htthttp之后的内容
// const a = url.replace(/http\w{0,1}:\/\//g, 'https://images.weserv.nl/?url=')

const url3 = "https://chain.xunlongruanjian.com/h5/app/#/pages_imapp/imPage/index"


const a = url3.replace(/http\w{0,1}:\/\//g, '')

console.log(a)
const _url = a.split('/')[0];

console.log(_url)

// files[i].name = /\.\w+$/.exec(files[i].path)[0]
// 去除了[.]
// /\w+$/


//获取文件名
let str = "compressed/1654159565054_IMG_20220602_141428_8.jpg"
var str22 = "c:/test1/test1/文件.pdf";
const num = 30

// let i = str.lastIndexOf(".")
// let c = str.slice(i)
// console.log(c)




const reg = /[^.]+$/;
var regEx = /([^<>\/\\|:""\*\?]+)\.\w+$/;
var regEx2 = /[^\/]+\w$/;
var regEx3 = /([^/])+$/g;


console.log(/[^0-9]/.test(num))
// console.log(reg.exec(num))

// console.log(regEx3.exec(str22)[0])

// const value = regEx3.exec(str22)

// const value = str22.replace(regEx3)
// const matches = regEx3.exec(str22);
// console.log(value)

// console.log(value.replace(/\.[^\.]+$/, ""))

// console.log('2--->',str22.match(regEx3))
// console.log(str22.match(regEx3)[0])




// 匹配 . 之前除换行符以外的所有字符替换为""
// const lastValue = str.replace(/.+\./, "")
// console.log('lastValue===',lastValue)   //拿到文件后缀


// var file_name = str.replace(/\.[^\.]+$/, "")
// console.log('匹配===',file_name)


// answer.join("|") 数组的分割
// let p = /mp4|jpg|jpeg|webp|bmp/.test(file_name)
// console.log(p)

//拿到文件后缀
// let reg = /\.[^\.]+$/
var fName = 'compressed/1654159565054_IMG_20220602_141428_8.jpg';
const matches = reg.exec(fName);
console.log(matches)


// const txt = '没1Rc错PMX就mDq是8lZ要mYL删_uT掉xhg一些Bw'
// console.log(txt.match(/\w+/g).join(''))






// if (/[^a-zA-Z0-9]/g.test(val)) { // 先过滤不需要的字符,只保留数字和字母
//     val = val.replace(/[^a-zA-Z0-9]/g, '');
// }
// if (!/^[A-Z\d]+$/.test(val)) {// 再进行转换,小写转为大写
// 	val = val.toUpperCase();
// }
console 命令行工具 X clear

                    
>
console