[mod_python] string manipulation

Nicolas Lehuen nicolas.lehuen at gmail.com
Sat Jan 28 15:43:45 EST 2006


Hi David,

That is the kind of question you can ask on comp.lang.python and get a
dozen different answers in a matter of minutes.

Not sure it belongs here, though.

Regards,
Nicolas

2006/1/28, David Worley <dworley at communityconnect.com>:
>
>
> 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
>
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>
>
>



More information about the Mod_python mailing list