How to write a regular expression in js to replace multiple matching substrings at the end of a string

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,"");


'aaaaddabcabcabc'.replace(/(abc)*$/g,''); //"aaaadd"
Menu