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

223
Vistas
Javascript regEx to remove all parentheses except between special characters

I need a regEx to remove all ( and ) from a string, except those between two @.

Example:

( [15] == @value 1@ || [15] == @value 2@ )  &&  ( [5] == @value 3 (ignore these)@ || [5] == @value 4@ )  ||  ( [2] == @value 5@ )

The string I need:

[15] == @value 1@ || [15] == @value 2@  &&  [5] == @value 3 (ignore these)@ || [5] == @value 4@  ||  [2] == @value 5@ 

I tried something with this non-capturing group to split with whitespaces except those between @ but could not find the way:

(?:@[^@]*@|\S)

I'm under pressure to solve this, any help is appreciated, thank you.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You may use this regex for matching:

\s*[()](?=(?:[^@]*@[^@]*@)*[^@]*$)\s*

And replace with just empty string.

RegEx Demo

RegEx Details:

  • \s*: Match 0 or more whitespaces
  • [()]: Match ( or )
  • (?=: Start positive lookahead
    • (?:[^@]*@[^@]*@)*: Match 0 or more pairs of @...@ substrings
    • [^@]*: Match 0 more of anything but @
    • $: End
  • ): End positive lookahead
  • \s*: Match 0 or more whitespaces
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