[mod_python] string manipulation

David Worley dworley at communityconnect.com
Sat Jan 28 15:36:16 EST 2006


OK, I'm stumped.

I'm trying to find newline characters (\n, specifically) that are NOT in comments.

So, for example (where "<-" = a newline character):
==========================================
1: <-
2: /*<-
3: ----------------------<-
4:     comment<-
5: ----------------------<-
6: */<-
7: <-
8: CODE CODE CODE<-
9: <-
==========================================

I want to return the newline characters at lines 1, 6, 7, 8, and 9 but NOT the others.

I've tried using regular expressions but I dislike them because they aren't immediately readable (and also I don't bloody understand the things). I'm not opposed to using them, though, if they provide a solution to this problem!

Thanks in advance for any suggestions anyone can provide.

- Dave

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20060128/0fdeaa27/attachment.html


More information about the Mod_python mailing list