I have a string like:
How are __ doing today ?. I'm doing __.
I wanted to replace every __ by a text box. So the purpose is '__' is indicated as a fill in the blanks in the question.
If you want to use the Angular templates, you can split the string into an array, like so:
sentence = "How are __ doing today ?. I'm doing __.";
parts = this.sentence.split("__");
Then, in the template, loop through the parts, and add an input for all but the last:
<span *ngFor="let part of parts; let last = last">
{{part}}
<input type="text" *ngIf="!last"/>
</span>
Here is a StackBlitz to show it working: https://stackblitz.com/edit/angular-eau2id?file=app%2Fapp.component.html
str.replace(/__/g, '<input type="text" />')