I have a text area
<textarea class="text-area" (focus)="focusIn()" (focusout)="focusout($event)" formControlName="text" name="" id="" cols="30" rows="10"></textarea>
I want to make some function that will detect when a user wrote # add some color for that word for example
hello #world
Here world will have some background
I have not an idea how to realize the function
You can use a regex to capture all text which will match a pattern which define the structure of you tags
let pattern = /(#\w+)/gm;
let chaine = "hello #world #another tags";
let matches = [...chaine.match(pattern)];
console.log(matches);
As tags start with a # character you can use this pattern /(#\w+)/gm with will capture all tags in a given string.
You can learn more about String.proptotype.match at this link