如何使用正则表达式从下面写的行中获取字符串'css'?
<link href="http://b2b.ap/css/jquery-ui/jquery-ui.css" rel="stylesheet">
最佳答案
如果这是您所期望的,以下正则表达式将检查文件扩展名是否为 css。
var regex = /.\.css$/;
var x = document.getElementsByTagName("link")[0];
console.log(x);
console.log(regex.test(x.href));
<link href="http://b2b.ap/css/jquery-ui/jquery-ui.css" rel="stylesheet">
关于css - 如何使用正则表达式从下面写的行中获取字符串 "css "?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54217681/