no warnings 'uninitialized'; s<\\(#)|\s*#[^\n]*$><$1>g
Note that I meet your examples as you entered them and remove the spaces before the "#" comment, unlike your code or most of the other code in this thread. I use [^\n] instead of just . since it is more explicit, especially since in this case it is important to stop at a newline.
- tye
In reply to Re: Stripping Comments (one)
by tye
in thread Stripping Comments
by hangon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |