Bug #3224

Regexp.new("...", nil, "n") is not documented

Added by marcandre (Marc-Andre Lafortune) about 2 years ago. Updated about 1 year ago.

[ruby-core:29893]
Status:Closed Start date:04/30/2010
Priority:Low Due date:
Assignee:marcandre (Marc-Andre Lafortune) % Done:

100%

Category:DOC
Target version:1.9.2
ruby -v:ruby 1.9.2dev (2010-04-30 trunk 27554) [x86_64-darwin10.3.0]

Description

While fixing the error messages for the number of parameters ( r27558 ), I noticed that Regexp.new accepts a third undocumented parameter.

Is it supported? If so it should be documented.

I also note that test_regexp.rb tests for the third parameter being "u",  even though this has no effect. Maybe these tests should be removed?

Associated revisions

Revision 27738
Added by naruse (Yui NARUSE) about 2 years ago

Add description about Regexp(str, opt, lang). [ruby-core:29893]

History

Updated by shyouhei (Shyouhei Urabe) about 2 years ago

That third argument to Regexp.new was effective in 1.8, but no longer in 1.9.  I'm not sure if that situation should be called supported.

Updated by mame (Yusuke Endoh) about 2 years ago

  • Assignee set to marcandre (Marc-Andre Lafortune)
Hi,

As Shyouhei said, the argument is ignored.  It left just for 1.8
compatibility.

Could you please add the fact into rdoc of Regexp#new and close
this ticket?

-- 
Yusuke Endoh <mame@tsg.ne.jp>

Updated by naruse (Yui NARUSE) about 2 years ago

3rd argument "n" and //n sets the regexp to NONE flag.

> Regexp.new("aa", nil, "n") =~ "\u3042aa"
(irb):11: warning: regexp match /.../n against to UTF-8 string

Updated by naruse (Yui NARUSE) about 2 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100
This issue was solved with changeset r27738.
Marc-Andre, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

Also available in: Atom PDF