徐同保的博客

web前端行业的小学生

vuePress-theme-reco 徐同保    2021
徐同保的博客 徐同保的博客

Choose mode

  • dark
  • auto
  • light
首页
博客
  • CSDN (opens new window)
  • 掘金 (opens new window)
  • 博客园 (opens new window)
  • 51CTO (opens new window)
开源项目
  • 无代码创建表格(react) (opens new window)
  • 小米书城(vue3) (opens new window)
  • 小米书城(vue3+vite) (opens new window)
  • 小米书城(nuxt) (opens new window)
联系作者
GitHub (opens new window)
author-avatar

徐同保

420

Articles

0

Tags

    首页
    博客
    • CSDN (opens new window)
    • 掘金 (opens new window)
    • 博客园 (opens new window)
    • 51CTO (opens new window)
    开源项目
    • 无代码创建表格(react) (opens new window)
    • 小米书城(vue3) (opens new window)
    • 小米书城(vue3+vite) (opens new window)
    • 小米书城(nuxt) (opens new window)
    联系作者
    GitHub (opens new window)

    js正则表达式匹配闭合标签

    vuePress-theme-reco 徐同保    2021

    js正则表达式匹配闭合标签

    徐同保 9/14/2021
      let htmlStr = fs.readFileSync(__dirname + '/data.xml', 'utf8')
      htmlStr = htmlStr
        .replace(/</g, '<')
        .replace(/>/g, '>')
        .replace(/"/g, '"')
        .replace(/\n/g, '')
      let itemArr = []
      htmlStr.replace(/<item(([\s\S])*?)<\/item>/g, (word) => {
        console.log(word)
        itemArr.push(word)
        return word
      })
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    在 GitHub 上编辑此页 (opens new window)
    上次更新: 9/15/2021, 2:48:45 PM