input:
"aaaaddabcabcabc"
use regular to replace the ending n "abc" with"
output:
"aaaadd"
the following can only replace the last substring:
nt
n
"\n\tqwe
\n\t<br />\n
qwe\n\n\n\t<br />\n
\n\n\t<br />\n
\n\n\t<br />\n
\n\n\t<br />\n
\n\n\t<br />\n
\n\n\t<br />\n
"
.replace(/(\n\t<br \/>\n<\/p>)*$/g,"");