A
azrazer
Hello,
I recently found an interesting issue on fr.comp.lang.perl and thought it
would be good to share [since not answers were found until now]. So here
it goes.
A file is slurped into a scalar variable (let say $my_text) [NOT AN
ARRAY].
This $my_text now contains many lines of this form : <code>;<comments>.
The question is : Using a regexp (with mg flags) How to do the following
for all lines at once ?
1/ if <code> contains a fixed word [let say WORD] then do not remove
comments
2/ if <code> does nots contain WORD then remove comments
I have tried using look-forward and behind regexps but i guess it is not
the good way of doing it. Also, i wanted to try using extended regexps
like (?(COND)true|false) but i ended up drawing a blank...
Any help appreciated !
Thanks a lot !
azra
I recently found an interesting issue on fr.comp.lang.perl and thought it
would be good to share [since not answers were found until now]. So here
it goes.
A file is slurped into a scalar variable (let say $my_text) [NOT AN
ARRAY].
This $my_text now contains many lines of this form : <code>;<comments>.
The question is : Using a regexp (with mg flags) How to do the following
for all lines at once ?
1/ if <code> contains a fixed word [let say WORD] then do not remove
comments
2/ if <code> does nots contain WORD then remove comments
I have tried using look-forward and behind regexps but i guess it is not
the good way of doing it. Also, i wanted to try using extended regexps
like (?(COND)true|false) but i ended up drawing a blank...
Any help appreciated !
Thanks a lot !
azra