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

206
Vistas
Detect JavaScript comments starting with **! using RegExp

I have tried a lot doing this using RegExp.

Pattern: \*.*\*!

Test text:

/**!
 * Plugin Name 1.0.0
 * @author  Name
 */

/*! Test */

/* Test */

/************************************************************************/
/******/ /* Test */
/******/
/*!*********************!*\
  !*** ./index.ts ***!
  \*********************/

Link for test: https://regexr.com/6eoa0

It works great and matches the first comment and that's what I need, but for some reason, it matches the other two comments.

How can make it detect comments that start with **! (in one line).

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

0

You can use

/\/\*\*![^*]*\*+(?:[^\/*][^*]*\*+)*\//g

See the regex demo. Details:

  • \/\*\*! - a /**! string
  • [^*]* - zero or more chars other than asterisks
  • \*+ - one or more asterisks
  • (?:[^\/*][^*]*\*+)* - zero or more sequences of
    • [^\/*] - any char other than a / and *
    • [^*]* - zero or more chars other than asterisk
    • \*+ - one or more asterisks
  • \/ - a / char.
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