'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).



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source