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

342
Vistas
Regex (JS) read data between two symbols

My changelog.md data looks like below.

## 11.2.3
* xxx
* xxxx

## 11.2.2
* ttt
* ttt

I need a regex that can return only the first versions list ie.

* xxx
* xxxx

I tried multiple solutions but, didn't reach the final result.

I tried matching, and replacing it, didn't work.

const changelog = `
## Hello World
* This is a bold text
* This is a bold text

## Hello World
* This is a bold text

## Hello World
* This is a bold text
`;

const final = changelog.match( /([^(##)])(.*)[^(##)]/g );
console.log(final);

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

0

You don't need to put ^## inside []. Square brackets are for making character sets, () is for grouping. There's no need to group it if you're not interested in that part.

Use the m modifier to make ^ match the beginning of a line instead of the the beginning of the string. Then .*\n will match the rest of that line. [^#]* will match everything after that until the next #.

const changelog = `
## Hello World
* This is a bold text
* This is a bold text

## Hello World
* This is a bold text

## Hello World
* This is a bold text
`;

const final = changelog.match(/^##.*\n([^#]*)/m);
console.log(final[1]);

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