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

258
Visualizações
How to prevent the following regex from matching ellipses?

I'm using this regex:

(?<=[.?!])\.

To match the period that comes after the final punctuation in a sentence. Example:

Sentence.. (The second period will be matched.)

Sentence sentence?. (The period will be matched.)

Sentence sentence!. (The period will be matched.)

It's been working fine so far ... except for ellipsis:

Sentence sentence... (The last two periods will be matched.)

How to modify this regex so it doesn't match ellipsis ...?

Live regex: https://regexr.com/6hf3n

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

As you already make use of a lookbehind, you might use:

(?<=[?!]|(?<!\.)\.(?!\.\.))\.

The pattern matches:

  • (?<= Positive lookbehind, assert what is to the left is
    • [?!] Match either ? or !
    • | Or
    • (?<!\.)\.(?!\.\.) A dot when there is no dot to the left, and not 2 dot to the right
  • ) Close lookbehind
  • \. Match a dot

See a regex demo.

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