我无法使用正则表达式将文本转换为标签

I'm having trouble converting text into a tag with regex

我的 div.content

中有示例文本
These is your very first content with Contentful, pulled in JSON format using the [Content Delivery API](https://www.contentful.com/developers/docs/references/content-delivery-api/ "Content Delivery API").
Content and presentation are now decoupled, allowing you to focus your efforts in building the perfect app.
## Your first steps Building with Contentful is easy. First take a moment to get [the basics of content modelling](https://www.contentful.com/r/knowledgebase/content-modelling-basics/ "the basics of content modelling"), which you can set up in the [Contentful Web app](https://app.contentful.com/ "Contentful Web app").
Once you get that, feel free to drop by the [Documentation](https://www.contentful.com/developers/docs/ "Documentation") to learn a bit more about how to build your app with Contentful, in particular the [API basics](https://www.contentful.com/developers/docs/concepts/apis/ "API basics") and each one of our four APIs, as shown below.

我想像这样获取所有字符串:

[the basics of content modelling](https://www.contentful.com/r/knowledgebase/content-modelling-basics/ "the basics of content modelling")

从本文中替换为 link a

并插入 html 个标签

<a href="https://www.contentful.com/r/knowledgebase/content-modelling-basics/ ">the basics of content modelling</a>

我正在使用那个正则表达式

let pattern = /\[(.*?)\]\((.*?)\)/gmi

您的模式缺少 () 包含 URL 和引号中的字符串。将 \s\".*?\" 添加到您的模式 - \s 匹配白色 space,如果您想在 URL[=14= 的末尾保留 space,则可以省略它]

let pattern = /\[(.*?)\]\((.*?)\s\".*?\"\)/gm;

let text = `These is your very first content with Contentful, pulled in JSON format using the [Content Delivery API](https://www.contentful.com/developers/docs/references/content-delivery-api/ "Content Delivery API").
 Content and presentation are now decoupled, allowing you to focus your efforts in building the perfect app.


## Your first steps

Building with Contentful is easy. First take a moment to get [the basics of content modelling](https://www.contentful.com/r/knowledgebase/content-modelling-basics/ "the basics of content modelling"), which you can set up in the [Contentful Web app](https://app.contentful.com/ "Contentful Web app"). 
Once you get that, feel free to drop by the [Documentation](https://www.contentful.com/developers/docs/ "Documentation") to learn a bit more about how to build your app with Contentful, in particular the [API basics](https://www.contentful.com/developers/docs/concepts/apis/ "API basics") and each one of our four APIs, as shown below.`

let result = text.replace(pattern, '<a href=""></a>')

console.log(result)