From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: kamphausen@creativepharma.com (Stefan Kamphausen) Newsgroups: gmane.emacs.help Subject: Re: I can't believe: replace regexp in a string Date: 17 Feb 2003 03:24:08 -0800 Organization: http://groups.google.com/ Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <62ede926.0302170324.70a32fc2@posting.google.com> References: <62ede926.0302140037.4db6c80a@posting.google.com> <5lheb6zwkj.fsf@rum.cs.yale.edu> <62ede926.0302150707.66866ad6@posting.google.com> <848ywhv3jg.fsf@lucy.is.informatik.uni-duisburg.de> NNTP-Posting-Host: main.gmane.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: main.gmane.org 1045481222 466 80.91.224.249 (17 Feb 2003 11:27:02 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 17 Feb 2003 11:27:02 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18kjQK-00007A-00 for ; Mon, 17 Feb 2003 12:27:00 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18kjPE-0000my-01 for gnu-help-gnu-emacs@m.gmane.org; Mon, 17 Feb 2003 06:25:52 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews1.google.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 25 Original-NNTP-Posting-Host: 217.226.222.126 Original-X-Trace: posting.google.com 1045481048 24311 127.0.0.1 (17 Feb 2003 11:24:08 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: 17 Feb 2003 11:24:08 GMT Original-Xref: shelby.stanford.edu gnu.emacs.help:110267 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:6769 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:6769 Hi, kai.grossjohann@uni-duisburg.de (Kai Großjohann wrote in message news:<848ywhv3jg.fsf@lucy.is.informatik.uni-duisburg.de>... > Generally, when parsing a text file it is often better to use general > movement functions rather than to rely on regular expressions. > (Sometimes, regexes are the right tool even in Emacs. But in Perl, a > regex is ALWAYS the right solution, in Emacs it SELDOM is.) > > For example, you could frob the syntax correctly and then what you're > looking for might be a word, or a string, or an s-expression. > > In your specific case, if you use searching in the buffer to find the > right spot, then you can use skip-syntax-backward or > skip-chars-backward to skip backwards over the trailing spaces. > Problem solved :-) Yes, I think I needed someone to point me to the fact that an lispish approach is probably different to a perlish one :-) Actually yesterday in the evening I managed to rewrite that parser and it now works in both Emacsen and doesn't need the replace-in-string anymore :-) More than that, the code is much cleaner now. Thanks and Regards stefan kamphausen