* string.c (rb_str_match_m): add description about optional
position parameter. [ruby-list:47064] patched by KISHIMOTO, Makoto <ksmakoto AT dd.iij4u.or.jp> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3b9c00306f
commit
ca3c007f05
@ -1,3 +1,9 @@
|
|||||||
|
Thu May 6 15:04:37 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
|
* string.c (rb_str_match_m): add description about optional
|
||||||
|
position parameter. [ruby-list:47064]
|
||||||
|
patched by KISHIMOTO, Makoto <ksmakoto AT dd.iij4u.or.jp>
|
||||||
|
|
||||||
Thu May 6 14:12:39 2010 Tanaka Akira <akr@fsij.org>
|
Thu May 6 14:12:39 2010 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* lib/tmpdir.rb: test RUBY_PLATFORM for loading tmpdir.so to avoid
|
* lib/tmpdir.rb: test RUBY_PLATFORM for loading tmpdir.so to avoid
|
||||||
|
5
string.c
5
string.c
@ -2556,11 +2556,14 @@ static VALUE get_pat(VALUE, int);
|
|||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* str.match(pattern) => matchdata or nil
|
* str.match(pattern) => matchdata or nil
|
||||||
|
* str.match(pattern, pos) => matchdata or nil
|
||||||
*
|
*
|
||||||
* Converts <i>pattern</i> to a <code>Regexp</code> (if it isn't already one),
|
* Converts <i>pattern</i> to a <code>Regexp</code> (if it isn't already one),
|
||||||
* then invokes its <code>match</code> method on <i>str</i>. If the second
|
* then invokes its <code>match</code> method on <i>str</i>. If the second
|
||||||
* parameter is present, it specifies the position in the string to begin the
|
* parameter is present, it specifies the position in the string to begin the
|
||||||
* search.
|
* search.
|
||||||
|
* If the second parameter is present, it specifies the position in the string
|
||||||
|
* to begin the search.
|
||||||
*
|
*
|
||||||
* 'hello'.match('(.)\1') #=> #<MatchData "ll" 1:"l">
|
* 'hello'.match('(.)\1') #=> #<MatchData "ll" 1:"l">
|
||||||
* 'hello'.match('(.)\1')[0] #=> "ll"
|
* 'hello'.match('(.)\1')[0] #=> "ll"
|
||||||
@ -2586,7 +2589,7 @@ rb_str_match_m(int argc, VALUE *argv, VALUE str)
|
|||||||
{
|
{
|
||||||
VALUE re, result;
|
VALUE re, result;
|
||||||
if (argc < 1)
|
if (argc < 1)
|
||||||
rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)", argc);
|
rb_raise(rb_eArgError, "wrong number of arguments (%d for 1..2)", argc);
|
||||||
re = argv[0];
|
re = argv[0];
|
||||||
argv[0] = str;
|
argv[0] = str;
|
||||||
result = rb_funcall2(get_pat(re, 0), rb_intern("match"), argc, argv);
|
result = rb_funcall2(get_pat(re, 0), rb_intern("match"), argc, argv);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user