Necesito su ayuda y estoy un poco perdido. Entonces quiero obtener "https://cloud.send.cm/i/00344/zofwynu8cxc7.jpg" de "https://send.cm/zofwynu8cxc7.html". Como puede ver, "zofwynu8cxc7" es el mismo en ambos enlaces, así que básicamente necesito copiar la identificación de esta foto en el otro enlace. Esto debería estar posiblemente usando expresiones regulares en js, pero no estoy muy seguro de cómo. Gracias
Aquí está el new URL("") :
no estoy seguro si path.slice() se puede hacer con URL()
let url = new URL("https://send.cm/zofwynu8cxc7.html") let path = url.pathname // /zofwynu8cxc7.html path = path.slice(0, path.length - 5) // /zofwynu8cxc7 console.log("https://cloud.send.cm/i/00344" + path + ".jpg")