【发布时间】:2023-03-16 05:20:01
【问题描述】:
我想以_ 开头,但不以相同的_ 结尾
这是我的输入:
const text = "I, ___________________________ (Photographer's Name), hereby grant _____________________________"
我试过了,但它返回多个数组长度:
let re = /_(.*?)_/;
let result = text.split(re);
console.log('result-------->>>>', result);
预期数组:
[
"I,",
"___________________________",
" (Photographer's Name), hereby grant ",
"_____________________________"
]
【问题讨论】:
-
我想为_制作自定义标记
标签: javascript arrays regex replace split