JSFiddle - React, Tailwind, and code Playground

JavaScript

var str = "-#A \
This text belongs to A. \
Dummy Text of A. \
-#B \
This text belongs to B. \
Dummy Text of B. \
-#C \
This text belongs to C. \
Dummy text of C. \
-#Garbage \
This string should be ignored";

alert(str.match(/-#([A-Z]) ([a-zA-Z. ]+)/g).map(function (i) {
   return i.split(/-#([A-Z])/).splice(1).join('\n')  + "\n\n"
}))