小编Jes*_*per的帖子

如何在文本中获取自定义标签并放入另一个文本中?

题主的问题可能不太好理解。希望您能理解我下面的详细信息。

我下面有句子数据,其中有一些标签,由 表示[tn]tag[/tn]

const sentence = `[t1]Sometimes[/t1] that's [t2]just the way[/t2] it has to be. Sure, there
 were [t3]probably[/t3] other options, but he didn't let them [t4]enter his mind[/t4]. It 
was done and that was that. It was just the way [t5]it[/t5] had to be.`
Run Code Online (Sandbox Code Playgroud)

我有这句话的一部分。

const parts = [
    "Sometimes that's just the way",
    "it has to be",
    "Sure,",
    "there were probably other options,",
    "but he didn't let them enter his mind.",
    "It was done and that …
Run Code Online (Sandbox Code Playgroud)

javascript regex

5
推荐指数
1
解决办法
133
查看次数

标签 统计

javascript ×1

regex ×1