bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

regexp does not work as documented


From: Bruno Haible
Subject: regexp does not work as documented
Date: Tue, 6 May 2008 03:30:45 +0200
User-agent: KMail/1.5.4

The regular expression (as an Emacs string)
  "^msgstr\\(\\[[0-9]\\]\\)?.*\n\\(\".*\n\\)*"
is supposed to search for a line starting with "msgstr" and an optional
digit inside brackets, followed by as many lines starting with a double-quote
as possible. The Emacs documentation says:

  "The matcher processes a `*' construct by matching, immediately, as
   many repetitions as can be found."

This is apparently not the case with the above regexp.

----------------------------------------------------------------------------

To reproduce:

$ emacs fr.po                or   $ emacs -nw fr.po
Leave the cursor at the beginning of the file.
M-x highlight-regexp
Regexp to highlight (enter this with Ctrl-Q Ctrl-J for each of the two
newlines):

^msgstr\(\[[0-9]\]\)?.*
\(".*
\)*

Highlight using face: hi-yellow

Then move around in the buffer and look which lines are highlighted.

In the first match already, only 5 out of 11 lines are highlighted. Then,
line 300 (in emacs 22) or line 335 (in emacs 21) are not highlighted either.


The attached screenshots were produced with emacs-22.2.1
(on i686-pc-linux-gnu) and with emacs-21.2.1 (on powerpc-apple-darwin7.9.0).

----------------------------------------------------------------------------

In GNU Emacs 22.2.1 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2008-05-01 on linuix
Windowing system distributor `The XFree86 Project, Inc', version 11.0.40300001
configured using `configure  '--prefix=/packages/gnu''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: POSIX
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: de_DE.UTF-8
  locale-coding-system: utf-8
  default-enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  line-number-mode: t

Recent input:
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <menu-bar> <help-menu> <send-emacs-bug-report>

Recent messages:
("emacs")
Loading cl-indent...done
Loading derived...done
For information about GNU Emacs and the GNU system, type C-h C-a.
Loading emacsbug...
Loading regexp-opt...done
Loading emacsbug...done

PS: Where is the bug tracker? I don't see it at 
https://savannah.gnu.org/projects/emacs

PNG image

PNG image

PNG image

PNG image

Attachment: fr.po.gz
Description: GNU Zip compressed data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]