home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!wupost!uwm.edu!rutgers!netnews.upenn.edu!widget.seas.upenn.edu!bwoelfel
- From: bwoelfel@widget.seas.upenn.edu (Brian Woelfel)
- Newsgroups: gnu.emacs.help
- Subject: Problem with regexp; not matching maximal # of characters
- Message-ID: <84399@netnews.upenn.edu>
- Date: 25 Jul 92 04:19:18 GMT
- Sender: news@netnews.upenn.edu
- Organization: University of Pennsylvania
- Lines: 46
- Nntp-Posting-Host: widget.seas.upenn.edu
-
- Hello all,
-
- I'm having a regexp problem. I think that emacs regexps don't always
- slurp up as many characters as they are supposed to.
-
- Here are two emacs regexps
-
- (1) "^\\([ab]+\\|bc\\)+$"
- (2) "^\\([ab]+\\|bc\\)+"
-
- and here is some data:
-
- (i) aaa
- (ii) aaaaaabc
- (iii) aaaabcaaabcbcaaabc
-
- Regexp (1) matches all three exactly. Regexp (2) matches this much:
-
- aaa
- aaaaaab
- aaaab
-
- that is, regexp (2) matches (i) exactly, but only parts of (ii) and
- (iii). However, studying regexp (2) shows that it *should indeed*
- match all of the data exactly. The same regexps translated into unix
- egrep regular expressions work as I expect, namely both of these:
-
- egrep '^([ab]+|bc)+$'
- egrep '^([ab]+|bc)+'
-
- match all the data exactly.
-
- Emacs version:
- "GNU Emacs 18.58.1 of Tue Mar 24 1992 on central.cis.upenn.edu (berkeley-unix)"
-
-
- Is this is a bug in emacs?
-
- Is there a better newsgroup to post this question to?
-
-
- Thanks a bunch,
-
- Brian Woelfel
- Univeristy of Pennsylvania
- Programmer for Penn Treebank Project
-