In my attempts I have omitted @_ and and was getting Use of uninitialized value $_, but forgotten about when you call it later on without any params. So, that works for multiline comments but not single line. I have put the following test input which I presume is valid Template::Toolkit comment syntax with the exception of nested comments which I am not sure. I will go the Parser way haukex posted. thanks
[%# comment nust be removed 1 %] [% # comment nust be removed 2 must stay 0 %] [% # comment nust be removed 3 must stay 1 %] [% # comment nust be removed 4 must stay 2 # comment nust be removed 5 [%# nested comment (not sure if allowed or not) 1 %] %] [%# comment nust be removed 6 comment nust be removed 7 comment nust be removed 8 [%# nested comment (not sure if allowed or not) 2 %] %] [% # comment nust be removed 9 [% comment nust be removed 10 %] [% # nested comment (not sure if allowed or not) 2 %] %] [% must stay 3 %] [% must stay 4 must stay 5 # comment nust be removed 11 %] [% # comment nust be removed 12 must stay 6 %]
In reply to Re^4: Regex for removing Template::Toolkit comments?
by bliako
in thread Regex for removing Template::Toolkit comments?
by bliako
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |