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

93
Views
How parse a comment with custom markup to html markup using regex javascript

Hay,

I'm trying to achieve the below using regex but it looks too complex.

Input: Hello, @[John Doe](600f2e41-0e31-4864-cb18-f8b255788f1c) please confirm with @[Rose Marie](600f2e41-0e33-6864-ab86-f8b255788f1c)

Output: Hello, <span>@John Doe</span> please confirm with <span>@Rose Marie</span>

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

0

This is the solution:

const comment = 'Hello, @[John Doe](600f2e41-0e31-4864-cb18-f8b255788f1c) please confirm with @[Rose Marie](600f2e41-0e33-6864-ab86-f8b255788f1c)';

const regex = /@\[(.*?)\]\(.*?\)/g;
return comment.replaceAll(regex, '<span>@$1</span>');
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!