You are viewing a single comment's thread from:

RE: JavaScript开发笔记

in #starnoteyesterday
语法: reg = /(?<=开始字符).*?(?=结束字符)/
function contentReg(text){
    //"content":"我是中"},"index"  提取中间的字符串
    // let reg = /!\[(.*?)\]\((.*?)\)/  
    // let reg =/\"content\"\:\"(.*?)\"\}\,\"index\"/g  
    
    let reg = /(?<=\"content\"\:\").*?(?=\"\}\,\"index\")/g
    // let reg = /\!\[.*?\)/
    let a = text.match(reg)
    if(a === null){
    return
    }
    console.log(11, a, a.join(''))
    return a
}
console.log(566, contentReg(textB))