ライブラリ
- English (60)
- ビルトイン (811)
- csv (36)
-
irb
/ cmd / help (12) - matrix (12)
-
minitest
/ spec (1) -
minitest
/ unit (1) -
net
/ telnet (10) - openssl (36)
- optparse (24)
- pathname (36)
- rake (12)
-
rdoc
/ context (24) -
rdoc
/ parser (12) -
rexml
/ document (36) -
rinda
/ rinda (24) -
ripper
/ lexer (12) -
rubygems
/ gem _ path _ searcher (24) -
rubygems
/ platform (12) -
rubygems
/ spec _ fetcher (24) - scanf (48)
- strscan (144)
クラス
- CSV (24)
- File (24)
-
Gem
:: GemPathSearcher (24) -
Gem
:: Platform (12) -
Gem
:: SpecFetcher (24) -
IRB
:: ExtendCommand :: Help (12) - MatchData (298)
-
Net
:: Telnet (8) - Object (13)
- OptionParser (24)
- Pathname (36)
-
RDoc
:: Context (24) -
RDoc
:: Parser (12) -
REXML
:: Elements (12) -
REXML
:: Entity (12) -
REXML
:: XPath (12) - Regexp (105)
-
Rinda
:: DRbObjectTemplate (12) - Ripper (12)
-
Scanf
:: FormatSpecifier (24) -
Scanf
:: FormatString (24) - String (81)
- StringScanner (144)
- Symbol (21)
モジュール
-
File
:: Constants (12) - Kernel (264)
-
MiniTest
:: Assertions (1) -
OpenSSL
:: X509 (36) -
Rake
:: TaskManager (12)
キーワード
-
$ & (12) -
$ & # 39; (12) -
$ 1 (12) -
$ 10 (12) -
$ 11 (12) -
$ 2 (12) -
$ 3 (12) -
$ 4 (12) -
$ 5 (12) -
$ 6 (12) -
$ 7 (12) -
$ 8 (12) -
$ 9 (12) -
$ LAST _ MATCH _ INFO (12) -
$ LAST _ PAREN _ MATCH (12) -
$ MATCH (12) -
$ POSTMATCH (12) -
$ PREMATCH (12) -
$ ` (12) -
$ ~ (12) -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) - == (12)
- =~ (12)
- CSV (12)
- DateMatcher (12)
- DateTimeMatcher (12)
- EPROGMISMATCH (12)
- ERPCMISMATCH (12)
- ErrDimensionMismatch (12)
-
FNM
_ DOTMATCH (12) - MatchData (12)
-
NEWS for Ruby 2
. 2 . 0 (11) -
NEWS for Ruby 2
. 4 . 0 (9) -
NEWS for Ruby 3
. 0 . 0 (5) -
NEWS for Ruby 3
. 1 . 0 (4) - NoMatchingPatternError (6)
- Regexp (12)
-
SCRIPT
_ LINES _ _ (12) - Telnet (2)
- Template (12)
-
V
_ ERR _ AKID _ ISSUER _ SERIAL _ MISMATCH (12) -
V
_ ERR _ AKID _ SKID _ MISMATCH (12) -
V
_ ERR _ SUBJECT _ ISSUER _ MISMATCH (12) - [] (48)
- accept (24)
-
assert
_ match (1) - begin (12)
- byteoffset (6)
- captures (12)
-
check
_ until (12) - cmd (4)
- compile (12)
- deconstruct (2)
-
deconstruct
_ keys (2) - end (12)
-
enhance
_ with _ matching _ rule (12) - eql? (12)
- execute (12)
- fetch (12)
-
find
_ matching (12) - fnmatch (24)
- fnmatch? (24)
- gsub (24)
- gsub! (12)
- hash (12)
- inspect (12)
- irb (12)
-
last
_ match (24) -
last
_ match _ tried (6) - length (12)
- match? (39)
-
match
_ fds (12) -
match
_ gen (12) - matched (18)
- matched? (12)
-
matched
_ count (6) -
matched
_ size (12) -
matched
_ string (6) - matchedsize (12)
- matches? (12)
-
matching
_ file? (12) -
matching
_ files (12) -
mid
_ match? (6) -
must
_ match (1) -
named
_ captures (12) - names (12)
- new (24)
- offset (24)
-
parse
_ files _ matching (12) -
post
_ match (24) -
pre
_ match (24) - prune (6)
- regexp (12)
-
rexml
/ document (12) -
ruby 1
. 6 feature (12) -
ruby 1
. 8 . 4 feature (12) -
ruby 1
. 9 feature (12) -
rubygems
/ commands / install _ command (12) -
rubygems
/ commands / pristine _ command (12) -
scan
_ full (12) -
scan
_ until (12) - size (12)
-
skip
_ until (12) - string (12)
- sub (36)
- sub! (12)
-
to
_ a (24) -
to
_ s (12) -
token
_ match (12) -
unmatched
_ alias _ lists (12) -
unmatched
_ alias _ lists= (12) - unscan (12)
-
values
_ at (12) - waitfor (4)
-
whole
_ match _ p (12) - ~ (12)
- クラス/メソッドの定義 (12)
- パターンマッチ (12)
- 正規表現 (12)
検索結果
先頭5件
-
Symbol
# match?(regexp , pos = 0) -> bool (6175.0) -
regexp.match?(self, pos) と同じです。 regexp が文字列の場合は、正規表現にコンパイルします。 詳しくは Regexp#match? を参照してください。
...regexp.match?(self, pos) と同じです。
regexp が文字列の場合は、正規表現にコンパイルします。
詳しくは Regexp#match? を参照してください。
例:
:Ruby.match?(/R.../) # => true
:Ruby.match?('Ruby') # => true
:Ruby.match?('Ruby',1) # => false
:R......uby.match?('uby',1) # => true
:Ruby.match?(/P.../) # => false
$& # => nil
@see Regexp#match?, String#match?... -
Regexp
. last _ match(nth) -> String | nil (6173.0) -
整数 nth が 0 の場合、マッチした文字列を返します ($&)。それ以外では、nth 番目の括弧にマッチ した部分文字列を返します($1,$2,...)。 対応する括弧がない場合やマッチしなかった場合には nil を返し ます。
..."
p Regexp.last_match # => #<MatchData:0x4599e58>
p Regexp.last_match(0) # => "ab"
p Regexp.last_match(1) # => "a"
p Regexp.last_match(2) # => "b"
p Regexp.last_match(3) # => nil
//}
正規表現全体がマッチしなかった場合、引数なしの
Regexp.last_match はnil を返......すため、
last_match[1] の形式では例外 NoMethodError が発生します。
対して、last_match(1) は nil を返します。
//emlist[例][ruby]{
str = "This is Regexp"
/That is Regexp/ =~ str
p Regexp.last_match # => nil
begin
p Regexp.last_match[1] # 例外が発生する
rescue......puts $! # => undefined method `[]' for nil:NilClass
end
p Regexp.last_match(1) # => nil
//}
@param nth 整数を指定します。
整数 nth が 0 の場合、マッチした文字列を返します。それ以外では、nth 番目の括弧にマッチした部分文字列を返します。... -
String
# match?(regexp , pos = 0) -> bool (6163.0) -
regexp.match?(self, pos) と同じです。 regexp が文字列の場合は、正規表現にコンパイルします。 詳しくは Regexp#match? を参照してください。
...regexp.match?(self, pos) と同じです。
regexp が文字列の場合は、正規表現にコンパイルします。
詳しくは Regexp#match? を参照してください。
//emlist[例][ruby]{
"Ruby".match?(/R.../) #=> true
"Ruby".match?(/R.../, 1) #=> false
"Ruby".match?(/P.../) #=>......false
$& #=> nil
//}
@see Regexp#match?, Symbol#match?... -
StringScanner
# post _ match -> String | nil (6137.0) -
前回マッチを行った文字列のうち、マッチしたところよりも後ろの 部分文字列を返します。前回のマッチが失敗していると常に nil を 返します。
...nner.new('test string')
s.post_match # => nil
s.scan(/\w+/) # => "test"
s.post_match # => " string"
s.scan(/\w+/) # => nil
s.post_match # => nil
s.scan(/\s+/) # => " "
s.post_match # => "string"
s.scan(/\w+/) # => "string"
s.post_match # => ""
s.scan(/\w+/) # => nil
s.post_match # => nil
//}... -
StringScanner
# pre _ match -> String | nil (6137.0) -
前回マッチを行った文字列のうち、マッチしたところよりも前の 部分文字列を返します。前回のマッチが失敗していると常に nil を 返します。
...gScanner.new('test string')
s.pre_match # => nil
s.scan(/\w+/) # => "test"
s.pre_match # => ""
s.scan(/\w+/) # => nil
s.pre_match # => nil
s.scan(/\s+/) # => " "
s.pre_match # => "test"
s.scan(/\w+/) # => "string"
s.pre_match # => "test "
s.scan(/\w+/) # => nil
s.pre_match # => nil
//}... -
Regexp
# match?(str , pos = 0) -> bool (6125.0) -
指定された文字列 str に対して 位置 pos から自身が表す正規表現によるマッチングを行います。 マッチした場合 true を返し、マッチしない場合には false を返します。 また、$~ などパターンマッチに関する組み込み変数の値は変更されません。
...ます。
また、$~ などパターンマッチに関する組み込み変数の値は変更されません。
//emlist[例][ruby]{
/R.../.match?("Ruby") # => true
/R.../.match?("Ruby", 1) # => false
/P.../.match?("Ruby") # => false
$& # => nil
//}
@see Regexp#match... -
StringScanner
# match?(regexp) -> Integer | nil (6125.0) -
スキャンポインタの地点だけで regexp と文字列のマッチを試します。 マッチしたら、スキャンポインタは進めずにマッチした 部分文字列の長さを返します。マッチしなかったら nil を 返します。
...e))
s.match?(/#{"\u{308B}".encode(encode)}/)
end
p case1("EUC-JP") #=> 2
//}
@param regexp マッチに用いる正規表現を指定します。
//emlist[例][ruby]{
require 'strscan'
s = StringScanner.new('test string')
p s.match?(/\w+/) #=> 4
p s.match?(/\w+/) #=> 4
p s.match?(/\s+/... -
Kernel
$ $ MATCH -> String | nil (6107.0) -
$& の別名
...$& の別名
require "English"
str = 'hoge,foo,bar,hee,hoo'
/(foo|bar)/ =~ str
p $MATCH #=> "foo"... -
Object
# must _ match(regexp) -> true (6107.0) -
自身が与えられた正規表現にマッチした場合、検査にパスしたことになります。
...文字列を指定した場合は文字列そのものにマッチする
正規表現に変換してから使用します。
@raise MiniTest::Assertion 自身が与えられた正規表現にマッチしなかった場合に発生します。
@see MiniTest::Assertions#assert_match... -
Kernel
$ $ LAST _ PAREN _ MATCH -> String | nil (6101.0) -
$+ の別名
$+ の別名
require "English"
r1 = Regexp.compile("<img src=(http:.+?)>")
r2 = Regexp.compile("<a href=(http|ftp).+?>(.+?)</a>")
while line = DATA.gets
[ r1, r2 ].each {|rep|
rep =~ line
p $+
}
end
__END__
<tr> <td><img src=http://localhost/a.jpg></td> <td>ikkou</td>... -
MiniTest
:: Assertions # assert _ match(regexp , str , message = nil) -> true (6101.0) -
与えられた文字列が与えられた正規表現にマッチした場合、検査にパスしたことになります。
与えられた文字列が与えられた正規表現にマッチした場合、検査にパスしたことになります。
@param regexp 正規表現か文字列を指定します。文字列を指定した場合は文字列そのものにマッチする
正規表現に変換してから使用します。
@param str 検査対象の文字列を指定します。
@param message 検査に失敗した場合に表示するメッセージを指定します。
文字列か Proc を指定します。Proc である場合は Proc#call した
結果を使用します。
@raise MiniTest... -
Scanf
:: FormatSpecifier # mid _ match? (6101.0) -
@todo
@todo -
Scanf
:: FormatString # last _ match _ tried (6101.0) -
@todo
@todo