URL Shortener can't pass invalid test

Tell us what’s happening:
I’m having trouble passing the final test for the URL shortener, even though I think I have a correct answer. I used a regular expression to determine if a URL passed is valid, and when I test it myself, it works, but the fcc test does not. I tried different Regular expressions and tried different error message strings (“invalid url” and “Invalid URL”).
Am I missing something?

Your code so far
Here is a snippet of that code that gets executed

app.post(
  "/api/shorturl/new",
  bodyParser.urlencoded({ extended: false }),
  (req, res) => {
    let inputShort = 1;
    let inputUrl = req.body.url;
    let urlRegex = new RegExp(
      /[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)?/gi
    );

    if (!inputUrl.match(urlRegex)) {
      return res.json({ error: "invalid url" });
    }

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.101 Safari/537.36.

Challenge: URL Shortener Microservice

Link to the challenge: