From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.help Subject: Re: Elisp: help on string operations Date: Tue, 08 Nov 2016 15:16:12 +0100 Message-ID: <87vavyxdjn.fsf@web.de> References: <2016-11-05T20-07-58@devnull.Karl-Voit.at> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1478614645 10412 195.159.176.226 (8 Nov 2016 14:17:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 8 Nov 2016 14:17:25 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) Cc: Karl Voit , help-gnu-emacs@gnu.org To: Karl Voit Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Nov 08 15:17:17 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c47Cw-0007wn-N3 for geh-help-gnu-emacs@m.gmane.org; Tue, 08 Nov 2016 15:17:02 +0100 Original-Received: from localhost ([::1]:33379 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c47Cz-0001ed-LN for geh-help-gnu-emacs@m.gmane.org; Tue, 08 Nov 2016 09:17:05 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55578) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c47CR-0001eX-73 for help-gnu-emacs@gnu.org; Tue, 08 Nov 2016 09:16:32 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c47CO-0005XN-2y for help-gnu-emacs@gnu.org; Tue, 08 Nov 2016 09:16:31 -0500 Original-Received: from mout.web.de ([212.227.15.4]:52642) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c47CN-0005Wv-Po for help-gnu-emacs@gnu.org; Tue, 08 Nov 2016 09:16:28 -0500 Original-Received: from drachen.dragon ([90.186.0.49]) by smtp.web.de (mrweb003) with ESMTPSA (Nemesis) id 0MVLY6-1cL66Y1vqA-00YmIB; Tue, 08 Nov 2016 15:16:24 +0100 X-Provags-ID: V03:K0:dei3UrifXjIYyCCA116P/LeRATwGCz18Mnuz86Nm7umGBSm+Bv9 7cJXuArS5oFw7NPKT8UV8ELHe6/DqTj6PcSmjFDyt7H+pTBki37QKx4R/6pDhI5j9F9xayT b8mvANdRAug5T/NLDJ3NzC1ruevhGBQ7L17r3j5J7hSMrkVi+kraiQ3IA5KyF9zKUiUhtzD UL0Dk2y9HlegP5CldFYCw== X-UI-Out-Filterresults: notjunk:1;V01:K0:i8pGSsNx1D8=:iR3IzotnLtHwdoUApG3Osq /aHEd0icVMeaCCcGCXF1cAQzL3t4nJQEB413aOBT/efVqDAG670Y8DHa7zEbykkGZs8hiSlMa NACb5i/llGyLzVjJY6W2xODwicJrEUrFGLvdS66Bb1X6T6uVxlmIlCDUqHroeWocIEQ5aAqRa ZaLgs/bAzQTvOhIoeVgqmuFkQa8TG4mYGZz2HvDnkzP+N5u/o3DP6sbytxvn4RiLkhCghw0+r dWW84bEUnjlPYOfAkd6FrEjhG5FwgXnIM8c11QFNXrnH5aQnHGlVSAqDAc0BujehRlri3PcjG QX28wkCQ/NHhvdl3lcHTSpQE9hQZd9xcWPEu349XxQPSq9A9ixnmA5WyEa4++M29eTQigsC35 F+BmvdIn53fuD0z2WSpKMbOrrBU5pmB2O6EtgeHKkL95+QfZ5KVh+GWOWEjpxbfHXzU+W3kw2 O1v4GQBqTKZgJX48jpJXkGl+rivGov/OJP9wpOeLKyjfDlXwJL3hZs6dTx57A4OG3CpsQZaRP 3APtWLE0CYeJj5Wdxk6zs4lYZm2M8QrpwvrYh1bH4m+ZdT9fcEK+VE92DIZGNdFEaqt7PRRJL O8bGRfenirFbrfTmmvS4oHC2AZGGvN6usOzQGCCmprdPdEHDuROBnkrbldUr1ft1rSy0x/DA3 dy2oGd8TyxMUNKVU9lZMiz2ls4Jrs+KNVOEX9xYbgvkqTr47olPzBBy0pO102JviIada/C72m 5VAuOuuIBO0dCS7Rd3gwj3iWWbSy9fjf/6uLO3TutxbAjY9myTr4CwthoKFXl6pwwcvKomxg X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.15.4 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:111685 Archived-At: Hello Karl, > I'd like to get a "Sorry" message for (1). Easy, if only I know how to > count lines in strings (as opposed to buffers). You could use `with-temp-buffer', insert the string and do your work there. Alternatively, go with `count-matches' or `split-string'. > (message (concat "result -> " result)) To avoid that a dynamically computed argument of `message' gets interpreted with format specifier syntax considered, it's better to use it like (message "%s" (compute-some-string-here)) > (re-search-forward " \[\[.+\]\[" nil t 1) ^^^^^^^^^^ That looks wrong. You want to have a backslash char before the brackets. But since backslash is an escape character in the read syntax of strings, you need to escape the backslash characters, which means you need to double the backslashes. Any questions left? Regards, Michael.