Regex remove comments but not shebang
I got a regex that removes the comments in bash using this regex code
but it also removes the #! which should be not because it's not a comment tag but a shebang
so how can it be done to ignore #! in regex?
This line will remove every comment starting with # but is not followed by an !.
This makes the ! optional