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

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

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 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