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

134
Vistas
número de anticipación de php de expresiones regulares

apiladores!

He estado tratando de resolver esto durante algún tiempo, pero sin suerte.
(.*?(?:\.|\?|!))(?: |$)

el patrón anterior captura y divide todas las oraciones en un párrafo con puntuación final.
ejemplo

  1. Hoy es el más grande. Eres el mejor.

El partido vuelve con tres

 Match { 1. Today is the greatest. You are the greatest. }

Sin embargo, estoy tratando de que no se rompa cuando hay un número con un punto y me gustaría ver la siguiente coincidencia en su lugar:

 Match { 1.Today is the greatest. You are the greatest. }

gracias por tu ayuda de antemano

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Usar

 .*?[.?!](?=(?<!\d\.)\s+|\s*$)

Ver prueba de expresiones regulares .

EXPLICACIÓN

 -------------------------------------------------------------------------------- .*? any character except \n (0 or more times (matching the least amount possible)) -------------------------------------------------------------------------------- [.?!] any character of: '.', '?', '!' -------------------------------------------------------------------------------- (?= look ahead to see if there is: -------------------------------------------------------------------------------- (?<! look behind to see if there is not: -------------------------------------------------------------------------------- \d digits (0-9) -------------------------------------------------------------------------------- \. '.' -------------------------------------------------------------------------------- ) end of look-behind -------------------------------------------------------------------------------- \s+ whitespace (\n, \r, \t, \f, and " ") (1 or more times (matching the most amount possible)) -------------------------------------------------------------------------------- | OR -------------------------------------------------------------------------------- \s* whitespace (\n, \r, \t, \f, and " ") (0 or more times (matching the most amount possible)) -------------------------------------------------------------------------------- $ before an optional \n, and the end of the string -------------------------------------------------------------------------------- ) end of look-ahead
over 4 years ago · Santiago Trujillo 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