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

141
Vistas
Regex appears correct but after passing to javascript replaceAll function it doesnt remove digits in the beggining as expected

I have a regex that I run on a text to remove digits before a "." as well as some random characters that may appear after it. This regex matches everything i need it to match which I confirmed in regex101.com. However when I pass it to my javascript function as a parameter to the replaceAll() function, the text returned still has some numbers at the end. After countless hours searching online, i still don't understand why this is happening. Does anyone know the cause?

Regex entered in regex101.com

(^[+-]?\d+(\.|\s|\-|)|(\s\-\.)|(\s\.)?)+(^\d\d|[^\u4E00-\u9FA5|a-zA-Z|\/:«»|0-9|();\n]|\d*[.])

Sample text:

11.君曰
1100.君曰
11.君曰
情奴(新版)
我在未来等着你
11.君曰
11.君曰
11678.君曰
11- -.情海孤舟
11 爱 .情海孤舟

Current output from my js function

updatedText = updatedText.replaceAll(/(^[+-]?\d+(\.|\s|\-|)|(\s\-\.)|(\s\.)?)+(^\d\d|[^\u4E00-\u9FA5|a-zA-Z|\/:«»|0-9|();\n]|\d*[.])/g, "");

output:
君曰
君曰
君曰
情奴(新版)
我在未来等着你
君曰
君曰
君曰
11情海孤舟
11爱情海孤舟

Any help in explaining why the 11's are still in the output would be awesome! Thanks in advance.

about 4 years ago · Juan Pablo Isaza
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