Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

159
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda