例如,我如何在字符串server:
rootPath: /api
或 bootstrap.addBundle(new AssetsBundle("/build", "/", "index.html"));
bootstrap.addBundle(new AssetsBundle("/build", "/login", "index.html"));
bootstrap.addBundle(new AssetsBundle("/build", "/dashboard", "index.html"));
中找到example.com
,例如如何用正则表达式找到一个字符串
https://example.com/path
答案 0 :(得分:2)
为什么不使用URL
const url = new URL("https://example.com/path");
console.log(url.hostname)
答案 1 :(得分:0)
您想知道字符串是否包含吗?
console.log(!!('https://example.com/path'.match(/example\.com/)))
此外,请检查以下内容: https://www.w3schools.com/jsref/jsref_includes.asp
可能对您有用