Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

163
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda