all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Matt Swift <swift@alum.mit.edu>
Subject: posix-string-match does not distinguish "*" from "*?"
Date: Sun, 16 Feb 2003 00:58:33 -0500	[thread overview]
Message-ID: <m2fzqo937a.fsf@beth.swift.xxx> (raw)



`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.

             reply	other threads:[~2003-02-16  5:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-16  5:58 Matt Swift [this message]
2003-02-17 13:59 ` posix-string-match does not distinguish "*" from "*?" Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2fzqo937a.fsf@beth.swift.xxx \
    --to=swift@alum.mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.