[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: Regular Expression to remove comments in a file
From: Adriaan de Groot <groot () kde ! org>
Date: 2004-08-30 13:25:53
Message-ID: 200408301525.53908.groot () kde ! org
[Download RAW message or body]
On Monday 30 August 2004 15:02, Mario wrote:
> Am Montag, 30. August 2004 13:28 schrieb Jeroen Wijnhout:
> > str.replace(QRegExp("^#.*$"), "\n");
>
> I tried it but i doesn't work, sorry don't know what the exp. will do.
Mario, this mailing list really isn't for random programming-related
questions. KDE-specific things, yes. "What is an RE", no.
That said, Jeroen's suggested RE has a beginning-of-line anchor (^) there,
which you will want to remove, so the RE you want is
#.*$
(An octothorpe, followed by whatever until the end of line). For completeness
you probably want to chew up whitespace before the # as well, so that you
leave your /boot/loader.conf in a minimal form.
You should be reading the file line-by-line, and dealing with possible
backslash-continuations yourself (I'm unsure whether loader.conf allows it,
though - it's parsed by a little forth program, nothing fancy).
--
As of September 1st, 2004, the University of Nijmegen will _still_ be the
University of Nijmegen, but with a different nonsensical adjective in front.
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic