如何使用Regex和JS获取最后一个点后面的单词?
const yeah = 'SampleLibrary/21.0/Best.colour' const hello = yeah.replace('(?<=\.|^)[^.]+$') console.log(hello)
预期输出
colour
oug3syen1#
这应该可行:
const yeah = 'SampleLibrary/21.0/Best.colour' const hello = yeah.replace(/^.+\./, ''); console.log(hello)
1条答案
按热度按时间oug3syen1#
这应该可行: