ライブラリ
- English (60)
- ビルトイン (761)
- csv (36)
-
irb
/ cmd / help (12) -
minitest
/ spec (1) -
minitest
/ unit (1) -
net
/ telnet (10) - openssl (36)
- optparse (24)
- pathname (36)
- rake (12)
-
rdoc
/ context (12) -
rdoc
/ parser (12) -
rexml
/ document (36) -
ripper
/ lexer (12) -
rubygems
/ gem _ path _ searcher (24) -
rubygems
/ platform (12) -
rubygems
/ spec _ fetcher (24) - strscan (144)
クラス
- CSV (24)
- File (24)
-
Gem
:: GemPathSearcher (24) -
Gem
:: Platform (12) -
Gem
:: SpecFetcher (24) -
IRB
:: ExtendCommand :: Help (12) - MatchData (302)
-
Net
:: Telnet (8) - Object (13)
- OptionParser (24)
- Pathname (36)
-
RDoc
:: Context (12) -
RDoc
:: Parser (12) -
REXML
:: Elements (12) -
REXML
:: Entity (12) -
REXML
:: XPath (12) - Regexp (105)
- Ripper (12)
- 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)
-
FNM
_ DOTMATCH (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) -
SCRIPT
_ LINES _ _ (12) - Telnet (2)
-
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)
- bytebegin (2)
- byteend (2)
- 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) - length (12)
- match? (39)
- matched (12)
- matched? (12)
-
matched
_ size (12) - matchedsize (12)
- matches? (12)
-
matching
_ file? (12) -
matching
_ files (12) -
must
_ match (1) -
named
_ captures (12) - names (12)
- new (12)
- offset (24)
-
parse
_ files _ matching (12) -
post
_ match (24) -
pre
_ match (24) - 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) - unscan (12)
-
values
_ at (12) - waitfor (4)
- ~ (12)
- クラス/メソッドの定義 (12)
- パターンマッチ (12)
- 正規表現 (12)
検索結果
先頭5件
-
MatchData
# pre _ match -> String (9213.0) -
マッチした部分より前の文字列を返します($`と同じ)。
...マッチした部分より前の文字列を返します($`と同じ)。
//emlist[例][ruby]{
/(bar)(BAZ)?/ =~ "foobarbaz"
p $~.pre_match # => "foo"
//}
@see MatchData#post_match... -
Regexp
. last _ match -> MatchData (6343.0) -
カレントスコープで最後に行った正規表現マッチの MatchData オ ブジェクトを返します。このメソッドの呼び出しは $~ の参照と同じです。
... MatchData オ
ブジェクトを返します。このメソッドの呼び出しは $~
の参照と同じです。
//emlist[例][ruby]{
/(.)(.)/ =~ "ab"
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
//}... -
Kernel
$ $ LAST _ MATCH _ INFO -> MatchData | nil (6337.0) -
$~ の別名
...href=https://www.ruby-lang.org/en/about/license.txt>license</a>"
if /<a href=(.+?)>/ =~ str
p $LAST_MATCH_INFO[0] #=> "<a href=https://www.ruby-lang.org/en/about/license.txt>"
p $LAST_MATCH_INFO[1] #=> "https://www.ruby-lang.org/en/about/license.txt"
p $LAST_MATCH_INFO[2] #=> nil
en... -
Ripper
. token _ match(src , pattern) -> Ripper :: TokenPattern :: MatchData | nil (6301.0) -
Ruby プログラム src に対してパターン pattern をマッチし、 マッチデータを返します。
Ruby プログラム src に対してパターン pattern をマッチし、
マッチデータを返します。
ライブラリ内部で使用します。 -
Gem
:: SpecFetcher # find _ matching(dependency , all = false , matching _ platform = true) -> Array (6300.0) -
依存関係を満たす gemspec の名前の配列を返します。
...返します。
@param dependency 依存関係を指定します。
@param all 真を指定するとマッチする全てのバージョンの情報を返します。
@param matching_platform 偽を指定すると全てのプラットフォームの情報を返します。
@see Gem::Dependency... -
Symbol
# match?(regexp , pos = 0) -> bool (6275.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 (6273.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 (6263.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 (6237.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 (6237.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
//}...