Вы можете match
, используя Unicode и replace
, Unicodes позже
Unicode finder
let str = `«Name» has an account on the bank «Bank Name»`
let final = str.match(/\u00AB.*?\u00BB/gu).map(v=>v.replace(/\u00AB|\u00BB/g,''))
console.log(final)
В качестве альтернативы вы можете использовать exec
и получить значение из захваченной группы
let str = `«Name» has an account on the bank «Bank Name»`
let final = []
let reg = /\u00AB(.*?)\u00BB/gu
while ((arr = reg.exec(str)) != null) {
final.push(arr[1])
}
console.log(final)