I have some files of this type:
/* 78 */ Lorem ipsum dolor sit amet
/* 79 */ Lorem ipsum dolor sit amet
/* eb */ Lorem ipsum dolor sit amet
/* HG */ Lorem ipsum dolor sit amet
/* */ Lorem ipsum dolor sit amet
/* 83 */ Lorem ipsum dolor sit amet
/* 84 */ Lorem ipsum dolor sit amet
/* */
/* */ Lorem ipsum dolor sit amet
/* ZX */ Lorem ipsum dolor sit amet
/* */ Lorem ipsum dolor sit amet
/* */ Lorem ipsum dolor sit amet
/* 90 */ Lorem ipsum dolor sit amet
/* 91 */ Lorem ipsum dolor sit amet
/* 92 */ Lorem ipsum dolor sit amet
And I want to eliminate the
/* */
/* 10 */
parts of text with regex, my regex looks like:
[/*(0-9)*/]
but it’s not working properly, it deletes some texts containing numbers
Everything inside
[and]is called a character class, which will always match just a single character.Inside a character class, the normal regex-meta-chars, like
*,(and), loose their special powers. So[*]matches just the literal'*'.In your case,
[/*(0-9)*/]will match one of the following chars:'/','*','(',')','/'or any (ASCII) digit.What you’re looking for is the regex:
which matches a
"/*"followed by zero or more space-chars (\s) or digits (0-9), ending with"*/". The^matches the start of the input, and adding a(?m)in front of it makes it match the start of a line.So it matches all multi-line comments from your example, except these: