【发布时间】:2021-01-10 05:46:21
【问题描述】:
我想拆分这段文字,
"Tom works. Tom is a student. Bob is a student."
进入这个,
["Tom", "works", ".", " ", "Tom", "is", "a", "student", ".", " ", "Bob", "is", "a", "student", "."]
我尝试过text.split(/(\.)(\s)/),但我不确定如何在不捕获空格的情况下添加分割。
【问题讨论】:
标签: javascript regex capturing-group