From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Platon Pronko Newsgroups: gmane.emacs.help Subject: Re: How to convert an arbitrary string into a filename Date: Wed, 26 Apr 2023 12:03:02 +0800 Message-ID: <4022908b-a023-3b3b-19a4-88ca90d055f3@gmail.com> References: <87wn1z8fgo.fsf@mbork.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15390"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 To: Marcin Borkowski , Help Gnu Emacs mailing list Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Apr 26 06:03:52 2023 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 1prWNk-0003lk-9X for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 26 Apr 2023 06:03:52 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prWN6-0008Ak-Nw; Wed, 26 Apr 2023 00:03:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1prWN4-0008AD-RR for help-gnu-emacs@gnu.org; Wed, 26 Apr 2023 00:03:10 -0400 Original-Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prWN3-0001Uv-AX for help-gnu-emacs@gnu.org; Wed, 26 Apr 2023 00:03:10 -0400 Original-Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-63b73203e0aso40142479b3a.1 for ; Tue, 25 Apr 2023 21:03:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682481787; x=1685073787; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=jS3XVPe8XkN+7RM1mf+r1385e59lO17v31bvqA/YhUY=; b=Cr0s3uLyJS6JyaVS+cJvDeDZXUN9s+kl/Tic7w275uhmKsOYElyoNWactgHJfcAuKJ YD8+qEA/ppMUZgES3EL63vjb6oNckrMENuqyLNelhAMSLwmS9eEHGqfr2sX0xXIgydml APRZBLjAiujnR0wNiUdBGhbDZnVYPaKrmOuCR3qK4eDjYFcf++fu9y/kt5RO7dEzOwUK /WxC09gPyC36fwFmxpyTnvvDgfuKH+52tKTX2k1j0qOtlVuifUfV7lNybIDYoHTfmWxm g92tIXTk4PBlE42Xt4nu0ZLrPyZoW6m04yjXC5M1G6DzrZUIMcDkcjwXgGhWHiX4AlbZ c3vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682481787; x=1685073787; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=jS3XVPe8XkN+7RM1mf+r1385e59lO17v31bvqA/YhUY=; b=ecDGqYTN7GEw+14qqvOGd1GF+BKKzTL0npYnaATB10qNm/maIwRCf9FvjOmNyajmVN 5fj0dVVjqPPDcOVG3UMkM1wpxXdgoCVle/BNmZo+T6v9O33MJPE5EYUpGkDUY9OK10wS 0jATpNPV8vAnv6M1ooPFZFa66j8RM+ZfhTR4GQZKbxZ1QULxkTdtGE+hS7lHVBs+LtwL so6B8054/miLP4BrCylBVOhqNhLDMQzjA5ALcgw/Ji8Ic+XBbPrt0ciQmtqCtzJmR7s1 VPH7ogyIHz6/85JPW6GLuK6dvrm2NJom/zmAe/tgjDU7E6RnEwyGBjWFDdIWgGHfGsq5 OTuA== X-Gm-Message-State: AC+VfDzTNitl5ZgVMBacNednkVgKYFyn37yYdW+Ihz2hY+EpEIIUIUxj qIrMFDyagwSOp9XIwgmVnajH4kfSCQEBHQ== X-Google-Smtp-Source: ACHHUZ7a/a7iFCzVdT5arUoq6+/6xAj3YEUENZdtQcMRIz+amBcE6ybN74qFHRvaEXPrHjZkyHvlCQ== X-Received: by 2002:a17:902:d2d0:b0:1a6:3def:5ff6 with SMTP id n16-20020a170902d2d000b001a63def5ff6mr1565577plc.4.1682481786587; Tue, 25 Apr 2023 21:03:06 -0700 (PDT) Original-Received: from [192.170.1.133] ([103.24.106.35]) by smtp.gmail.com with ESMTPSA id i13-20020a170902eb4d00b001a5023e7395sm8919620pli.135.2023.04.25.21.03.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 25 Apr 2023 21:03:06 -0700 (PDT) Content-Language: en-US In-Reply-To: <87wn1z8fgo.fsf@mbork.pl> Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=platon7pronko@gmail.com; helo=mail-pf1-x434.google.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, NICE_REPLY_A=-1.422, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 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-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:143386 Archived-At: On 2023-04-26 11:55, Marcin Borkowski wrote: > Hi all, > > given an arbitrary string, say "Hello, world!!!", I want to have > a filename with all the runs of weird characters (that is, > non-alphanumeric ones) converted to dashes (say, "Hello-world"). Is > there a function for that in Emacs already or should I write my own? Something like this? (let ((input "Hello, world!!!")) (replace-regexp-in-string "[^a-zA-Z0-9]+" "-" input)) ;; "Hello-world-" -- Best regards, Platon Pronko PGP 2A62D77A7A2CB94E