From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Matt Swift Newsgroups: gmane.emacs.bugs Subject: posix-string-match does not distinguish "*" from "*?" Date: Sun, 16 Feb 2003 00:58:33 -0500 Sender: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1045375069 31304 80.91.224.249 (16 Feb 2003 05:57:49 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 16 Feb 2003 05:57:49 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18kHoC-00088k-00 for ; Sun, 16 Feb 2003 06:57:48 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18kHpt-0007cp-08 for gnu-bug-gnu-emacs@m.gmane.org; Sun, 16 Feb 2003 00:59:33 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18kHpn-0007XQ-00 for bug-gnu-emacs@gnu.org; Sun, 16 Feb 2003 00:59:27 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18kHpF-0006Uw-00 for bug-gnu-emacs@gnu.org; Sun, 16 Feb 2003 00:58:56 -0500 Original-Received: from pool-68-160-54-133.bos.east.verizon.net ([68.160.54.133] helo=beth.swift.xxx) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18kHoz-0006A5-00 for bug-gnu-emacs@gnu.org; Sun, 16 Feb 2003 00:58:38 -0500 Original-Received: from beth.swift.xxx (swift@localhost [127.0.0.1]) h1G5wXBH008792verify=FAIL) for ; Sun, 16 Feb 2003 00:58:33 -0500 Original-Received: (from swift@localhost) by beth.swift.xxx (8.12.6/8.12.6/Debian-8) id h1G5wX3I008790; Sun, 16 Feb 2003 00:58:33 -0500 Original-To: bug-gnu-emacs@gnu.org User-Agent: Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.2 X-Mailscanner: clean (beth.swift.xxx) X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Bug reports for GNU Emacs, the Swiss army knife of text editors List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.bugs:4471 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:4471 `posix-string-match' (and I presume the other `posix-*' searching functions) do not seem to distinguish between the "*" and "*?" operators. No mention is made of this difference from `string-match' in the Elisp manual, which describes the posix- functions as having super-greedy repetition constructs and handling of "|", but a reader would not guess that these functions differ with respect to the explicitly non-greedy operators "*?", "+?" and "??". Since I do not have access to the POSIX specs, someone else will have to discern whether this is a dox bug or a bug in `posix-string-match'. This is the example from the manual description of the non-greedy operators: (let ((s "cdaaada") (rshort "c[ad]*?a")) (list (progn (string-match rshort s) (match-string 0 s)) (progn (posix-string-match rshort s) (match-string 0 s)) )) => ("cda" "cdaaada") node (elisp)POSIX Regexps: The usual regular expression functions do backtracking when necessary to handle the `\|' and repetition constructs, but they continue this only until they find _some_ match. Then they succeed and report the first match found. This section describes alternative search functions which perform the full backtracking specified by the POSIX standard for regular expression matching. They continue backtracking until they have tried all possibilities and found all matches, so they can report the longest match, as required by POSIX. This is much slower, so use these functions only when you really need the longest match.