From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas Roehler Newsgroups: gmane.emacs.devel Subject: string-strip Date: Tue, 20 Jun 2006 12:26:11 +0200 Message-ID: <4497CD43.6060102@easy-emacs.de> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1150830948 29572 80.91.229.2 (20 Jun 2006 19:15:48 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 20 Jun 2006 19:15:48 +0000 (UTC) Cc: Richard Stallman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jun 20 21:15:46 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FslhK-0001LK-88 for ged-emacs-devel@m.gmane.org; Tue, 20 Jun 2006 21:15:38 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FslhJ-0000YW-Ko for ged-emacs-devel@m.gmane.org; Tue, 20 Jun 2006 15:15:37 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FsdJZ-0000Ur-My for emacs-devel@gnu.org; Tue, 20 Jun 2006 06:18:33 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FsdJX-0000Uf-V7 for emacs-devel@gnu.org; Tue, 20 Jun 2006 06:18:33 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FsdJX-0000Uc-SB for emacs-devel@gnu.org; Tue, 20 Jun 2006 06:18:31 -0400 Original-Received: from [212.227.126.183] (helo=moutng.kundenserver.de) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FsdU1-0002Lt-3p; Tue, 20 Jun 2006 06:29:21 -0400 Original-Received: from [84.190.140.12] (helo=[192.168.178.23]) by mrelayeu.kundenserver.de (node=mrelayeu5) with ESMTP (Nemesis), id 0ML25U-1FsdJM3CN6-0003w8; Tue, 20 Jun 2006 12:18:21 +0200 User-Agent: Thunderbird 1.5.0.4 (X11/20060516) Original-To: emacs-devel@gnu.org X-Provags-ID: kundenserver.de abuse@kundenserver.de login:62d13292e0fce6aaed56aaadcb96352d X-Mailman-Approved-At: Tue, 20 Jun 2006 15:15:28 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:56039 Archived-At: Looks great. Thanks. Here with this example included: (defun string-strip (str) "Return a copy of STR with leading and trailing white space removed. \(string-strip \" foo \") => \"foo\" \(string-strip \" \\nfoo\\n \") => \"foo\" \(string-strip \" foo\\nbar \") => \"foo\\nbar\" \(string-strip \" \") => \"\" \(string-strip \" \\n \") => \"\" " (save-match-data (string-match "\\`[[:space:]\n]*\\(\\(?:.\\|\n\\)*?\\)[[:space:]\n]*\\'" str) (match-string 1 str)))