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

197
Vistas
Regex – How to match everything outside brackets […] AND outside two exclamation marks with a pipe in-between !…|…!?

I was able to match everything outside the square brackets using ([^\[\]]+)(?:$|(?=\[)), which gives me:

!Bat_Boy.png|thumbnail! !visagepaume.png|thumbnail!, Test comment: public., Test comment: internal., [^TEST_ATTACHMENT.txt], Test comment: public!, !visagepaume.png|thumbnail!, Test comment: internal!, [^TEST_ATTACHMENT.txt]

Is there a way to write a single regex that would also match outside two exclamation marks with a pipe in-between, in addition? This is to be used with a single java string replaceAll() method. Basically, I am looking for this result:

!Bat_Boy.png|thumbnail! !visagepaume.png|thumbnail!, Test comment: public., Test comment: internal., [^TEST_ATTACHMENT.txt], Test comment: public!, !visagepaume.png|thumbnail!, Test comment: internal!, [^TEST_ATTACHMENT.txt]

Notes:

  • I am including the pipe in-between as a requirement mainly because there could be exclamation marks in those "test comments", and I thought maybe this would help.
  • Don't think I need to worry about nesting [] or !
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