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

154
Views
Regex for duplicate words in a string with one of them with a apostrophe in Angular

I want to create a regex for a requirement, a string is having duplicate words but in that duplicate words one is with a apostrophe.

For example:

EXCHANGE CORRESPONDENCE WITH BOLNO'S COUNSEL RE SCHEDULING INTERVIEW WITH DAVID BOLNO.

I am using this regex to validate by this way and splitting the string with that word.

var splitArray = this.narrative.split(new RegExp("\\b(" + this.misspelledWords[m] + ")\\b"))

But this regex string is considering BOLNO and BOLNO'S as single word.But I want to create my regex in such a way that it should consider BOLNO'S and BOLNO as different.

Can anyone help me this one.

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

0

You can use

new RegExp("\\b(" + this.misspelledWords[m] + ")(?!['\\w])"

This also implies the this.misspelledWords[m] word cannot contain special chars.

The (?!['\w]) negative lookahead fails the match if there is a ' or a word char immediately on the right.

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!