From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Christopher Howard Newsgroups: gmane.emacs.help Subject: Regular expressions and user-escaped characters Date: Mon, 02 Dec 2024 13:04:45 -0900 Message-ID: <87plm9g2rm.fsf@librehacker.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36912"; mail-complaints-to="usenet@ciao.gmane.io" To: Help Gnu Emacs Mailing List Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 02 23:05:28 2024 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 1tIEXo-0009Qj-1s for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 02 Dec 2024 23:05:28 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tIEXP-0002eP-RY; Mon, 02 Dec 2024 17:05:03 -0500 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 1tIEXN-0002dm-T9 for help-gnu-emacs@gnu.org; Mon, 02 Dec 2024 17:05:02 -0500 Original-Received: from mx.kolabnow.com ([212.103.80.155]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tIEXL-0004Pl-Ib for help-gnu-emacs@gnu.org; Mon, 02 Dec 2024 17:05:01 -0500 Original-Received: from localhost (unknown [127.0.0.1]) by mx.kolabnow.com (Postfix) with ESMTP id 511CB2092287 for ; Mon, 2 Dec 2024 23:04:57 +0100 (CET) Authentication-Results: ext-mx-out011.mykolab.com (amavis); dkim=pass (2048-bit key) reason="pass (just generated, assumed good)" header.d=kolabnow.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kolabnow.com; h= content-transfer-encoding:content-type:content-type:mime-version :message-id:date:date:subject:subject:from:from:received :received:received; s=dkim20240523; t=1733177096; x=1734991497; bh=tfFtz4fGIxE/C39bKxrk1NBKqg6G8BDoUbnVc45hvdw=; b=qsScy4liatnJ hugLCzDinxUbkJFA92xSATjIZ887wSQNvD5h11VQfelgt3wZj6V6CnL4sJgFC6t2 tqR5+o+zjewac0XtoUeq+JTOzvTkOvzYmgXP6L5pu5gyRtJ/yp7jePTjsp5ylt/F NegfHHmUxSxiTwjAx02RmdTYTgZxxboS0sv708gP/A9W7bf5svuSITSPFT3Kxy15 dvtedfBpHgUPnlvzcl6AeI9IpLGRZfD3mfVYhe0VW94Ipo4s0gP+ffN2CBoHMgpa sESyvq3nAvcK+Bzx0vXr5pjgpB9gVy6Qmq3oGCBZz3FULcjRrVXBS3f4IMBdUFtf buYxkBMb4g== X-Virus-Scanned: amavis at mykolab.com Original-Received: from mx.kolabnow.com ([127.0.0.1]) by localhost (ext-mx-out011.mykolab.com [127.0.0.1]) (amavis, port 10024) with ESMTP id mo_XNmpSQdnZ for ; Mon, 2 Dec 2024 23:04:56 +0100 (CET) Original-Received: from int-mx011.mykolab.com (unknown [10.9.13.11]) by mx.kolabnow.com (Postfix) with ESMTPS id 5D7A52092288 for ; Mon, 2 Dec 2024 23:04:54 +0100 (CET) Original-Received: from ext-subm010.mykolab.com (unknown [10.9.6.10]) by int-mx011.mykolab.com (Postfix) with ESMTPS id 3939C3E4173 for ; Mon, 2 Dec 2024 23:04:54 +0100 (CET) Received-SPF: none client-ip=212.103.80.155; envelope-from=christopher@librehacker.com; helo=mx.kolabnow.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 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:148514 Archived-At: Hi, what do you do in a regular expression if you want to match a character= , but not a the same character that has been escaped by the user. E.g., if = I want my regular expression to look for ?\[ (ASCII 91), matching string "[= " and "a[a" but not string "\\[" or "a\\[a", if you follow me. Is this poss= ible with just a regular expression? If not, what is a good workaround? I was wondering about, say, replacing al= l the escaped characters first with some uncommon character (like a control= code) and then converting back afterwards. But then I suppose I would need= to do a check for that uncommon character first. --=20 =F0=9F=93=9B Christopher Howard =F0=9F=9A=80 gemini://gem.librehacker.com =F0=9F=8C=90 http://gem.librehacker.com =D7=91=D7=A8=D7=90=D7=A9=D7=99=D7=AA =D7=91=D7=A8=D7=90 =D7=90=D7=9C=D7=94= =D7=99=D7=9D =D7=90=D7=AA =D7=94=D7=A9=D7=9E=D7=99=D7=9D =D7=95=D7=90=D7=AA= =D7=94=D7=90=D7=A8=D7=A5