Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

323
Views
how to detect all hashtags in textarea angular typescript

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

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!