From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Emanuel Berg via Users list for the GNU Emacs text editor Newsgroups: gmane.emacs.help Subject: Re: count matches in string, not region? Date: Wed, 26 Feb 2020 22:22:14 +0100 Message-ID: <875zftdoxl.fsf@ebih.ebihd> References: <87a756gedt.fsf@ebih.ebihd> <87pne1g92p.fsf@ebih.ebihd> <009f6fb0-8191-48f5-8541-52d95cfecd83@beta.fastmail.com> Reply-To: Emanuel Berg Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="62242"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) To: help-gnu-emacs@gnu.org Cancel-Lock: sha1:VD+ENQr/LzNyggIywc51hyVv0ps= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 26 22:23:00 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j748x-000G66-Qo for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 26 Feb 2020 22:22:59 +0100 Original-Received: from localhost ([::1]:50254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j748w-0001gi-Sp for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 26 Feb 2020 16:22:58 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57389) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j748O-0001fn-Ou for help-gnu-emacs@gnu.org; Wed, 26 Feb 2020 16:22:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j748N-0007ky-JL for help-gnu-emacs@gnu.org; Wed, 26 Feb 2020 16:22:24 -0500 Original-Received: from ciao.gmane.io ([159.69.161.202]:40174) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j748N-0007fL-DC for help-gnu-emacs@gnu.org; Wed, 26 Feb 2020 16:22:23 -0500 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1j748J-000FPp-KN for help-gnu-emacs@gnu.org; Wed, 26 Feb 2020 22:22:19 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Mail-Copies-To: never X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 159.69.161.202 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:122486 Archived-At: Tassilo Horn wrote: > Another way would be > > (string-match-p "^[[:digit:]]\\{13\\}$" isbn) > > which returns non-nil iff isbn is a string of > exactly thirteen digits. Okay ... another way of doing ...? Here is an example of an ISBN-10: 0-13-308504-X and here is an ISBN-13: 978-91-0-011493-0 the check digit is the last one (X meaning 10, and 0, respectively), so actually one only needs 9 digits in the first case and 12 in the second, to compute the check digit. The groupings (...-...-...-...) do mean things but not with respect to how the check digit is computed, so one can just drop dashes and all chars that aren't digits. More examples in the old file, https://dataswamp.org/~incal/emacs-init/isbn-verify.el Thanks for the mail tho, I really want to close the BOOK on this, so fire away all suggestion you have :) -- underground experts united http://user.it.uu.se/~embe8573 https://dataswamp.org/~incal