DarkWater Posted September 28, 2008 Share Posted September 28, 2008 I'm kinda bored, so I'm just playing around with some regexes in Perl (among other things for serious reasons), and I was trying to think of a way to parse comments out of a script. Just # comments for now, since I can easily adapt it to the // comments. Anyway, I couldn't think of a good way to make sure that they weren't in quotes since you lookbehind assertions need to be fixed width. Any ideas? Link to comment https://forums.phpfreaks.com/topic/126172-parsing-out-comments-in-a-script/ Share on other sites More sharing options...
DarkWater Posted September 28, 2008 Author Share Posted September 28, 2008 Ha, I found one by Friedl: s#/\*[^*]*\*+([^/*][^*]*\*+)*/|("(\\.|[^"\\])*"|'(\\.|[^'\\])*'|.[^/"'\\]*)#defined $2 ? $2 : ""#gse; I didn't think it would be that ridiculous, so you can just ignore this topic. xD Link to comment https://forums.phpfreaks.com/topic/126172-parsing-out-comments-in-a-script/#findComment-652451 Share on other sites More sharing options...
nrg_alpha Posted September 28, 2008 Share Posted September 28, 2008 I didn't think it would be that ridiculous, so you can just ignore this topic. xD Consider it done! Link to comment https://forums.phpfreaks.com/topic/126172-parsing-out-comments-in-a-script/#findComment-652553 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.