Actions
Bug #12454
closed
Updated by grajagandev (David Moore) about 9 years ago
- File bug-12454-ascii added
Here is a simpler case - it is an ascii only, valid regular expression according to grep:
# cat bug-12454-ascii
((?<V>0(00*)(\0>))00*00*00*$00*)(\g<0>)00*00*00*
# xxd bug-12454-ascii
0000000: 2828 3f3c 563e 3028 3030 2a29 285c 303e ((?<V>0(00*)(\0>
0000010: 2929 3030 2a30 302a 3030 2a24 3030 2a29 ))00*00*00*$00*)
0000020: 285c 673c 303e 2930 302a 3030 2a30 302a (\g<0>)00*00*00*
0000030: 24 $
# grep -f bug-12454-ascii -E -r
#
Updated by nobu (Nobuyoshi Nakada) almost 9 years ago
More shorter code, probably same issue:
$ ruby -e 'Regexp.new("((?<v>))\\g<0>")'
-e:1:in `initialize': undefined type (bug): /((?<v>))\g<0>/ (RegexpError)
from -e:1:in `new'
from -e:1:in `<main>'
Updated by naruse (Yui NARUSE) almost 9 years ago
- Status changed from Open to Closed
Applied in changeset r55562.
- regcomp.c (noname_disable_map): don't optimize out group 0
Ruby's Regexp doesn't allow normal numbered groups if the regexp
has named groups. On such case it optimizes out related NT_ENCLOSE.
But even on the case it can use \g<0>.
This fix not to remove NT_ENCLOSE whose regnum is 0.
[ruby-core:75828] [Bug ]
Updated by usa (Usaku NAKAMURA) almost 9 years ago
- Backport changed from 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN to 2.1: WONTFIX, 2.2: REQUIRED, 2.3: REQUIRED
Updated by nagachika (Tomoyuki Chikanaga) almost 9 years ago
- Backport changed from 2.1: WONTFIX, 2.2: REQUIRED, 2.3: REQUIRED to 2.1: WONTFIX, 2.2: REQUIRED, 2.3: DONE
ruby_2_3 r55908 merged revision(s) 55562.
Updated by usa (Usaku NAKAMURA) almost 9 years ago
- Backport changed from 2.1: WONTFIX, 2.2: REQUIRED, 2.3: DONE to 2.1: WONTFIX, 2.2: DONE, 2.3: DONE
ruby_2_2 r55939 merged revision(s) 55562.
Actions
Like0Like0Like0Like0Like0Like0Like0