function endWith(str, endStr) { str = str.trim() let d = str.length - endStr.length return d >= 0 && str.lastIndexOf(endStr) == d }
let reg = /(.+(?=[<aaaa>]$))/ console.log( 'a<aaaa>'), reg.test('<aaaa>'))