Regex cutting off anything after space in the url

Heres the current regex : const regex = /(https?://\S+)\s\n\s(Canonical|\d)/g; it gives back: "http://www.stjosephnewwaverlytx.net/Religious" want it to give me the full url: "http://www.stjosephnewwaverlytx.net/Religious" + " Education/Teachers and Staff/Lessons/Misc/Sacraments.jpg Tried for a couple of hours to get it working but with no luck. Any help would be appreciated. Thanks!
3 Replies
peterkyle01
peterkyle0112mo ago
Try const regex = /(https?://\S+/\S+)\s\n\s(Canonical|\d)/g;
DivMode
DivMode12mo ago
hmm it just seems to not match anything
DivMode
DivMode12mo ago
regex101
regex101: build, test, and debug regex
Regular expression tester with syntax highlighting, explanation, cheat sheet for PHP/PCRE, Python, GO, JavaScript, Java, C#/.NET, Rust.