/\*\s*( ?!@ )(?:(?!\*/).)*\*/
Interrupted as:
/ \ * // "/ *"
\ s * // optional space
( ?!@ ) // not followed by "@"
(?: // don't capture ...
(?! \ * /). // ... anything that is not "* /"
) * // but match it as often as possible
\ * / // "* /"
Use in global and dotall mode (for example, the dot should also match new lines)
A common warning word: like all parsing jobs that run with regular expressions, this will lead to a crash on nested patterns and broken input.
emk points out a good example of input (otherwise valid) that will cause this expression to break. This cannot help, regular expression is not for parsing. If you are sure that such things can never happen in your input, a regular expression may still work for you.
source share