如何使用 Regex 和 JS 在最后一個點之后獲取單詞?
const yeah = 'SampleLibrary/21.0/Best.colour'
const hello = yeah.replace('(?<=\.|^)[^.] $')
console.log(hello)
預期輸出
colour
uj5u.com熱心網友回復:
這應該有效:
const yeah = 'SampleLibrary/21.0/Best.colour'
const hello = yeah.replace(/^. \./, '');
console.log(hello)
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/528905.html
