Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/368.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript I';我很难用正则表达式将文本转换成标记_Javascript_Regex_Replace_Gridsome - Fatal编程技术网

Javascript I';我很难用正则表达式将文本转换成标记

Javascript I';我很难用正则表达式将文本转换成标记,javascript,regex,replace,gridsome,Javascript,Regex,Replace,Gridsome,我的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 presentati

我的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.
您的模式丢失,
()
在引号中同时包含URL和字符串。将
\s\“*?\”
添加到您的模式中-
\s
匹配空格,如果您想在URL末尾留下空格,可以省略它

let pattern=/\[(.*?\]\(.*?\s\“*?\”)/gm;
let text=`这是您第一个使用[content Delivery API]以JSON格式获取的内容,内容丰富(https://www.contentful.com/developers/docs/references/content-delivery-api/ “内容交付API”)。
内容和演示现在已解耦,允许您集中精力构建完美的应用程序。
##你的第一步
用知足来建设是很容易的。首先花点时间了解[内容建模的基础知识](https://www.contentful.com/r/knowledgebase/content-modelling-basics/ “内容建模基础”),您可以在[Contentful Web app]中设置(https://app.contentful.com/ “内容Web应用”)。
一旦你得到了,请随意访问[文档](https://www.contentful.com/developers/docs/ “文档”),进一步了解如何使用Contentful构建应用程序,特别是[API基础知识](https://www.contentful.com/developers/docs/concepts/apis/ “API基础”)和四个API中的每一个,如下所示`
让结果=文本。替换(模式“”)

console.log(result)
如果您创建并与我们共享该链接,我们将更容易帮助您。非常感谢您,这并不难,我还需要了解更多。 [the basics of content modelling](https://www.contentful.com/r/knowledgebase/content-modelling-basics/ "the basics of content modelling")
<a href="https://www.contentful.com/r/knowledgebase/content-modelling-basics/ ">the basics of content modelling</a>
let pattern = /\[(.*?)\]\((.*?)\)/gmi