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


Need Your Help

Running same Asynctask multiple times sequentially

android android-asynctask

I am trying to execute same Asynctask sequentially. For example, Let there be an Asynctask A. Now assume A checks if some server is busy or not. If it's busy, it checks again.... And so on. Let's s...

How to handle files in an OOP way?

php oop symfony2 symfony-2.1

I need to copy, move, and delete files.