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

146
Vistas
Regex Help -- Ignore in between quotes

I know there's a million and one question & answers on Regex but I can't seem to find a straight-forward one that helps me solve this problem while also understanding it.

I want to take a String and ignore anything in the String that is between two quotes. For example,

String myString = "(\"You entered a value of \" + moneyAmount + \" 
dollars.\");";

How do I get it so anything between quotes ("You entered a value" and "dollars.") is forgotten? I would want my new String to be:

( + moneyAmount + );

Thank you and please help me understand regez!!

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

0

You could use \".*?\" (but you have to escape the literal backslash and the quote, so it looks it a little funky). Like,

System.out.println(myString.replaceAll("\\\".*?\\\"", ""));

Outputs (as requested)

( + moneyAmount + );
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