ライブラリ
- ビルトイン (603)
- csv (24)
- etc (12)
-
json
/ add / regexp (24) -
minitest
/ spec (2) -
minitest
/ unit (1) - pathname (12)
-
rdoc
/ markup (24) -
rdoc
/ parser (24) - resolv (84)
- strscan (120)
- uri (36)
クラス
- CSV (24)
- MatchData (12)
- Module (1)
- Object (13)
- Pathname (12)
-
RDoc
:: Markup (24) -
RDoc
:: Options (24) -
RDoc
:: Parser (24) - Regexp (393)
- Resolv (12)
-
Resolv
:: IPv4 (12) -
Resolv
:: IPv6 (60) - String (129)
- StringScanner (120)
- Symbol (33)
モジュール
- Etc (12)
- Kernel (24)
-
MiniTest
:: Assertions (1) - URI (36)
キーワード
-
$ -F (12) -
$ ; (12) - == (12)
- === (12)
- =~ (12)
- AddressRegex (12)
- DateMatcher (12)
- DateTimeMatcher (12)
- EXTENDED (12)
- FIXEDENCODING (12)
- IGNORECASE (12)
-
LABEL
_ LIST _ RE (12) - MULTILINE (12)
- NOENCODING (12)
- RREGEXP (12)
-
Regex
_ 6Hex4Dec (12) -
Regex
_ 8Hex (12) -
Regex
_ CompressedHex (12) -
Regex
_ CompressedHex4Dec (12) - Regexp (12)
- RegexpError (12)
-
SC
_ REGEXP (12) -
SEPARATOR
_ PAT (12) -
SIMPLE
_ LIST _ RE (12) - UNSAFE (12)
- [] (36)
- []= (36)
-
assert
_ match (1) - casefold? (12)
- check (12)
-
check
_ until (12) - compile (12)
- encoding (12)
- eql? (12)
- escape (12)
- exclude (12)
- exist? (12)
-
extra
_ accessors (12) -
fixed
_ encoding? (12) - hash (12)
-
infect
_ with _ assertions (1) - inspect (12)
-
json
/ add / regexp (12) -
json
_ create (12) -
last
_ match (24) - match (48)
- match? (39)
-
must
_ match (1) -
named
_ captures (12) - names (12)
- new (12)
-
parse
_ files _ matching (12) - parsers (12)
- quote (12)
- scan (12)
-
scan
_ full (12) -
scan
_ until (12) -
search
_ full (12) - skip (12)
-
skip
_ until (12) - slice (36)
- slice! (12)
- source (12)
-
to
_ json (12) -
to
_ regexp (12) -
to
_ s (12) -
try
_ convert (12) - union (12)
- ~ (12)
- 正規表現 (12)
検索結果
先頭5件
-
URI
. regexp -> Regexp (24410.0) -
URIにマッチする正規表現を返します。
...どうかは必要に応じて別途
検査してください。
このメソッドは Ruby 2.2 から obsolete です。
@param schemes マッチさせたいスキームを、文字列の配列として与えます。
例:
require 'uri'
p URI.regexp =~ "http://www.ruby-lang.org/" #=> 0... -
URI
. regexp(schemes) -> Regexp (24410.0) -
URIにマッチする正規表現を返します。
...どうかは必要に応じて別途
検査してください。
このメソッドは Ruby 2.2 から obsolete です。
@param schemes マッチさせたいスキームを、文字列の配列として与えます。
例:
require 'uri'
p URI.regexp =~ "http://www.ruby-lang.org/" #=> 0... -
MatchData
# regexp -> Regexp (24408.0) -
自身の元になった正規表現オブジェクトを返します。
...自身の元になった正規表現オブジェクトを返します。
//emlist[例][ruby]{
m = /a.*b/.match("abc")
m.regexp # => /a.*b/
//}... -
Resolv
:: IPv6 :: Regex -> Regexp (18366.0) -
IPv6のアドレスの正規表現です。 Resolv::IPv6::Regex_6Hex4Dec, Resolv::IPv6::Regex_8Hex, Resolv::IPv6::Regex_CompressedHex, Resolv::IPv6::Regex_CompressedHex4Dec, のいずれかとマッチする文字列とマッチします。
...IPv6のアドレスの正規表現です。
Resolv::IPv6::Regex_6Hex4Dec,
Resolv::IPv6::Regex_8Hex,
Resolv::IPv6::Regex_CompressedHex,
Resolv::IPv6::Regex_CompressedHex4Dec,
のいずれかとマッチする文字列とマッチします。... -
Resolv
:: IPv4 :: Regex -> Regexp (18302.0) -
IPv4 のアドレスの正規表現です。
IPv4 のアドレスの正規表現です。 -
Object
# to _ regexp -> Regexp (12430.0) -
オブジェクトの Regexp への暗黙の変換が必要なときに内部で呼ばれます。 デフォルトでは定義されていません。
...オブジェクトの Regexp への暗黙の変換が必要なときに内部で呼ばれます。
デフォルトでは定義されていません。
説明のためここに記載してありますが、
このメソッドは実際には Object クラスには定義されていません。
必......ての場面で代置可能であるような、
* 正規表現そのものとみなせるようなもの
という厳しいものになっています。
//emlist[][ruby]{
class Foo
def to_regexp
/[\d]+/
end
end
it = Foo.new
p Regexp.union(/^at/, it) #=> /(?-mix:^at)|(?-mix:[\d]+)/
//}... -
struct RRegexp * RREGEXP(VALUE obj) (12400.0)
-
-
Regexp
. union(*pattern) -> Regexp (12383.0) -
引数として与えた pattern を選択 | で連結し、Regexp として返します。 結果の Regexp は与えた pattern のどれかにマッチする場合にマッチするものになります。
...引数として与えた pattern を選択 | で連結し、Regexp として返します。
結果の Regexp は与えた pattern のどれかにマッチする場合にマッチするものになります。
//emlist[][ruby]{
p Regexp.union(/a/, /b/, /c/) # => /(?-mix:a)|(?-mix:b)|(?-mix:c)/
//}......ay を与えても Regexp を生成します。
つまり、以下のように書くことができます。
//emlist[][ruby]{
arr = [/a/, /b/, /c/]
p Regexp.union(arr) # => /(?-mix:a)|(?-mix:b)|(?-mix:c)/
# 1.8.7 より前は、以下のように書く必要があった
p Regexp.union(*arr) # =>......rn は Regexp または String で与えます。
String で与えた場合、それ自身と等しい文字列にマッチするものと解釈され、
エスケープされて結果の Regexp に組み込まれます。
//emlist[][ruby]{
p Regexp.union("a", "?", "b") # => /a|\?|b/
p Regexp.union... -
Regexp
. compile(string , option = nil) -> Regexp (12304.0) -
文字列 string をコンパイルして正規表現オブジェクトを生成して返します。
...@param option Regexp::IGNORECASE, Regexp::MULTILINE,
Regexp::EXTENDED
の論理和を指定します。
Integer 以外であれば真偽値の指定として見なされ
、真(nil, false 以外)であれば
Regexp::IGNORECASE......じになります。
@raise RegexpError 正規表現のコンパイルに失敗した場合発生します。
//emlist[例][ruby]{
str = "This is Regexp"
t1 = Regexp.compile("this is regexp", Regexp::IGNORECASE)
t1.match(str)
p $~ # => "This is Regexp"
t2 = Regexp.compile('
this # こ......使用されない
\ is
\ regexp # ここも使用されない
', Regexp::EXTENDED | Regexp::IGNORECASE)
t2.match(str)
p Regexp.last_match # => "This is Regexp"
str = "ふるいけや\nかわずとびこむ\nみずのおと"
t2 = Regexp.compile("ふる.*?と", Regexp::MULTILINE)
p t2.match(str)... -
Regexp
. compile(string , option = nil , code = nil) -> Regexp (12304.0) -
文字列 string をコンパイルして正規表現オブジェクトを生成して返します。
...@param option Regexp::IGNORECASE, Regexp::MULTILINE,
Regexp::EXTENDED
の論理和を指定します。
Integer 以外であれば真偽値の指定として見なされ
、真(nil, false 以外)であれば
Regexp::IGNORECASE......を出力します。
@raise RegexpError 正規表現のコンパイルに失敗した場合発生します。
//emlist[例][ruby]{
str = "This is Regexp"
t1 = Regexp.compile("this is regexp", Regexp::IGNORECASE)
t1.match(str)
p $~ # => "This is Regexp"
t2 = Regexp.compile('
this # こ......使用されない
\ is
\ regexp # ここも使用されない
', Regexp::EXTENDED | Regexp::IGNORECASE)
t2.match(str)
p Regexp.last_match # => "This is Regexp"
str = "ふるいけや\nかわずとびこむ\nみずのおと"
t2 = Regexp.compile("ふる.*?と", Regexp::MULTILINE)
p t2.match(str)...