Project

General

Profile

Actions

Bug #557

closed

Regexp does not match longest string

Added by WimYedema (Wim Yedema) over 16 years ago. Updated over 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
[ruby-core:18535]

Description

=begin
Regexp does not match the longest string, as do regular expression for Linux (or posix).
For example:

irb(main):001:0> r=/foo|footer/
=> /foo|footer/
irb(main):002:0> r.match('footer').offset(0)
=> [0, 3]

The same thing in C (see attachment), results in
match: 0, 6
=end


Files

re.c (260 Bytes) re.c regular expression C example WimYedema (Wim Yedema), 09/10/2008 09:15 PM
Actions #1

Updated by shyouhei (Shyouhei Urabe) over 16 years ago

  • Status changed from Open to Closed

=begin
Not a bug. Leftmost match is preferred.

% echo 'footer' | perl -pe 's/foo|footer/($&)/;'
(foo)ter

=end

Actions

Also available in: Atom PDF

Like0
Like0