If you need to do only with regex, this is really not a very difficult decision:
"/ *" ([^ *] | (\ * + [^ * /])) * \ * + \ /
The full explanation and conclusion of this regular expression is well developed in
here .
In short: "/ *" indicates the beginning of a comment ([^ *] | (\ * + [^ * /])) * accepts all characters that are not * ([^ *]), or accept a sequence of one or more *, if the sequence does not have "*" or "/" on it ((* + [^ * /])). This means that all ****** ... sequences will be accepted except ***** /, since you cannot find a sequence * that is not followed by * or a /. The case ******* / is handled by the last RegEx bit, which matches any number *, followed by the / character, to mark the end of the comment ie \ * + \ /
Abraham philip
source share