種類
ライブラリ
- English (12)
- ビルトイン (979)
- abbrev (24)
- csv (24)
- etc (744)
-
json
/ add / regexp (24) -
minitest
/ spec (2) -
minitest
/ unit (1) - optparse (24)
- pathname (12)
-
rdoc
/ markup (24) -
rdoc
/ parser (24) - readline (12)
- resolv (84)
- scanf (12)
- strscan (120)
- uri (36)
-
webrick
/ httputils (24)
クラス
- Array (12)
- CSV (24)
- MatchData (12)
- Module (1)
- NilClass (7)
- Object (34)
- OptionParser (24)
- Pathname (12)
-
RDoc
:: Markup (24) -
RDoc
:: Options (36) -
RDoc
:: Parser (24) - Regexp (393)
- Resolv (12)
-
Resolv
:: IPv4 (12) -
Resolv
:: IPv6 (60) - String (297)
- StringScanner (120)
- Symbol (33)
モジュール
- Abbrev (12)
- Etc (744)
- Kernel (228)
-
MiniTest
:: Assertions (1) - Readline (12)
- URI (36)
-
WEBrick
:: HTTPUtils (24)
キーワード
- !~ (12)
-
$ & (12) -
$ & # 39; (12) -
$ -F (12) -
$ 1 (12) -
$ 10 (12) -
$ 11 (12) -
$ 2 (12) -
$ 3 (12) -
$ 4 (12) -
$ 5 (12) -
$ 6 (12) -
$ 7 (12) -
$ 8 (12) -
$ 9 (12) -
$ ; (12) -
$ LAST _ PAREN _ MATCH (12) -
$ ` (12) -
$ ~ (12) -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) - == (12)
- === (12)
- =~ (28)
- AddressRegex (12)
- DateMatcher (12)
- DateTimeMatcher (12)
- EXTENDED (12)
- FIXEDENCODING (12)
- IGNORECASE (12)
-
LABEL
_ LIST _ RE (12) - MULTILINE (12)
- Marshal フォーマット (12)
-
NEWS for Ruby 2
. 4 . 0 (9) -
NEWS for Ruby 2
. 5 . 0 (8) -
NEWS for Ruby 3
. 0 . 0 (5) - NOENCODING (12)
- RREGEXP (12)
- Regex (24)
-
Regex
_ 6Hex4Dec (12) -
Regex
_ 8Hex (12) -
Regex
_ CompressedHex (12) -
Regex
_ CompressedHex4Dec (12) - RegexpError (12)
- Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (12)
- Rubyの起動 (12)
-
SC
_ 2 _ PBS (12) -
SC
_ 2 _ PBS _ ACCOUNTING (12) -
SC
_ 2 _ PBS _ CHECKPOINT (12) -
SC
_ 2 _ PBS _ LOCATE (12) -
SC
_ 2 _ PBS _ MESSAGE (12) -
SC
_ 2 _ PBS _ TRACK (12) -
SC
_ 2 _ UPE (12) -
SC
_ AIO _ PRIO _ DELTA _ MAX (12) -
SC
_ AVPHYS _ PAGES (12) -
SC
_ CPUSET _ SIZE (12) -
SC
_ CPUTIME (12) -
SC
_ EXPR _ NEST _ MAX (12) -
SC
_ GETPW _ R _ SIZE _ MAX (12) -
SC
_ IPV6 (12) -
SC
_ MAPPED _ FILES (12) -
SC
_ MEMORY _ PROTECTION (12) -
SC
_ MESSAGE _ PASSING (12) -
SC
_ MQ _ OPEN _ MAX (12) -
SC
_ MQ _ PRIO _ MAX (12) -
SC
_ NGROUPS _ MAX (12) -
SC
_ NPROCESSORS _ CONF (12) -
SC
_ NPROCESSORS _ ONLN (12) -
SC
_ OPEN _ MAX (12) -
SC
_ PAGESIZE (12) -
SC
_ PAGE _ SIZE (12) -
SC
_ PHYS _ PAGES (12) -
SC
_ PRIORITIZED _ IO (12) -
SC
_ PRIORITY _ SCHEDULING (12) -
SC
_ REGEXP (12) -
SC
_ RE _ DUP _ MAX (12) -
SC
_ SEMAPHORES (12) -
SC
_ SPAWN (12) -
SC
_ SPIN _ LOCKS (12) -
SC
_ SPORADIC _ SERVER (12) -
SC
_ SS _ REPL _ MAX (12) -
SC
_ SYMLOOP _ MAX (12) -
SC
_ THREAD _ CPUTIME (12) -
SC
_ THREAD _ PRIORITY _ SCHEDULING (12) -
SC
_ THREAD _ PRIO _ INHERIT (12) -
SC
_ THREAD _ PRIO _ PROTECT (12) -
SC
_ THREAD _ PROCESS _ SHARED (12) -
SC
_ THREAD _ ROBUST _ PRIO _ INHERIT (12) -
SC
_ THREAD _ ROBUST _ PRIO _ PROTECT (12) -
SC
_ THREAD _ SPORADIC _ SERVER (12) -
SC
_ TYPED _ MEMORY _ OBJECTS (12) -
SC
_ V6 _ ILP32 _ OFF32 (12) -
SC
_ V6 _ ILP32 _ OFFBIG (12) -
SC
_ V6 _ LP64 _ OFF64 (12) -
SC
_ V6 _ LPBIG _ OFFBIG (12) -
SC
_ V7 _ ILP32 _ OFF32 (12) -
SC
_ V7 _ ILP32 _ OFFBIG (12) -
SC
_ V7 _ LP64 _ OFF64 (12) -
SC
_ V7 _ LPBIG _ OFFBIG (12) -
SC
_ XOPEN _ CRYPT (12) -
SC
_ XOPEN _ ENH _ I18N (12) -
SC
_ XOPEN _ REALTIME (12) -
SC
_ XOPEN _ REALTIME _ THREADS (12) -
SC
_ XOPEN _ SHM (12) -
SC
_ XOPEN _ STREAMS (12) -
SC
_ XOPEN _ UNIX (12) -
SC
_ XOPEN _ UUCP (12) -
SC
_ XOPEN _ VERSION (12) -
SEPARATOR
_ PAT (12) -
SIMPLE
_ LIST _ RE (12) - UNSAFE (12)
- [] (84)
- []= (84)
- abbrev (24)
- accept (24)
-
assert
_ match (1) - casefold? (12)
- check (12)
-
check
_ until (12) - compile (12)
-
completion
_ proc= (12) - encoding (12)
- eql? (12)
- escape (24)
-
escape
_ path (12) - exclude (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)
- print (12)
- quote (12)
- regexp (36)
-
ruby 1
. 6 feature (12) -
ruby 1
. 8 . 2 feature (12) -
ruby 1
. 9 feature (12) - scan (12)
-
scan
_ full (12) -
scan
_ until (12) - scanf (12)
-
search
_ full (12) - skip (12)
-
skip
_ until (12) - slice (84)
- slice! (24)
- source (12)
-
to
_ json (12) -
to
_ regexp (12) -
to
_ s (12) -
try
_ convert (12) - union (12)
- yaml (12)
- ~ (12)
- リテラル (12)
- 多言語化 (12)
- 正規表現 (12)
検索結果
先頭5件
-
Regexp (44090.0)
-
正規表現のクラス。正規表現のリテラルはスラッシュで囲んだ形式 で記述します。
...is regexp/
//}
Regexp.new(string) を使って正規表現オブジェクトを動的に生成する
こともできます。
//emlist[][ruby]{
str = "this is regexp"
rp1 = Regexp.new("^this is regexp")
p rp1 =~ str # => 0
p Regexp.last_match[0] # => "this is regexp"
//}
spec/regexp......や d:spec/literal#regexp も参照してください。......]{
/^this is regexp/
//}
Regexp.new(string) を使って正規表現オブジェクトを動的に生成する
こともできます。
//emlist[][ruby]{
str = "this is regexp"
rp1 = Regexp.new("^this is regexp")
p rp1 =~ str # => 0
p Regexp.last_match[0] # => "this is regexp"
//}
Ruby......3.0.0 から正規表現リテラルは freeze されるようになりました。
//emlist[][ruby]{
p /abc/.frozen?
# => true
p /a#{42}bc/.frozen?
# => true
p Regexp.new('abc').frozen?
# => false
//}
spec/regexp や d:spec/literal#regexp も参照してください。... -
Regexp
# options -> Integer (27360.0) -
正規表現の生成時に指定されたオプションを返します。戻り値は、 Regexp::EXTENDED, Regexp::IGNORECASE, Regexp::MULTILINE, Regexp::FIXEDENCODING, Regexp::NOENCODING, の論理和です。
...正規表現の生成時に指定されたオプションを返します。戻り値は、
Regexp::EXTENDED, Regexp::IGNORECASE,
Regexp::MULTILINE,
Regexp::FIXEDENCODING,
Regexp::NOENCODING,
の論理和です。
これで得られるオプションには生成時に指定したもの以外の
オ......Regexp.new にこれらを
渡しても無視されます。
//emlist[例][ruby]{
p Regexp::IGNORECASE # => 1
p //i.options # => 1
p Regexp.new("foo", Regexp::IGNORECASE ).options # => 1
p Regexp.new("foo", Regexp::EXTENDED).options # => 2
p Regexp.new("foo", Regexp::IGNORECASE | Regexp:.......options # => 3
p Regexp.new("foo", Regexp::MULTILINE).options # => 4
p Regexp.new("foo", Regexp::IGNORECASE | Regexp::MULTILINE ).options # => 5
p Regexp.new("foo", Regexp::MULTILINE | Regexp::EXTENDED).options # =>6
p Regexp.new("foo", Regexp::IGNORECASE | Regexp::MULTILINE | Regexp::EXTENDED).opt... -
Regexp
. compile(string , option = nil) -> Regexp (27322.0) -
文字列 string をコンパイルして正規表現オブジェクトを生成して返します。
...を複製して返します。第二引数は警告の上無視されます。
@param string 正規表現を文字列として与えます。
@param option Regexp::IGNORECASE, Regexp::MULTILINE,
Regexp::EXTENDED
の論理和を指定します。
Integer......あれば
Regexp::IGNORECASE の指定と同じになります。
@raise RegexpError 正規表現のコンパイルに失敗した場合発生します。
//emlist[例][ruby]{
str = "This is Regexp"
t1 = Regexp.compile("this is regexp", Regexp::IGNORECASE)
t1.match(str)
p $~ # => "T......exp"
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.compil... -
Regexp
. compile(string , option = nil , code = nil) -> Regexp (27322.0) -
文字列 string をコンパイルして正規表現オブジェクトを生成して返します。
...して返します。第二、第三引数は警告の上無視されます。
@param string 正規表現を文字列として与えます。
@param option Regexp::IGNORECASE, Regexp::MULTILINE,
Regexp::EXTENDED
の論理和を指定します。
Integer......ば
Regexp::IGNORECASE の指定と同じになります。
@param code "n", "N" が与えられた時には、生成された正規表現のエンコーディングは ASCII-8BIT になります。
それ以外の指定は警告を出力します。
@raise RegexpError......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_m... -
Regexp
# inspect -> String (27134.0) -
Regexp#to_s より自然な文字列を返します。
...Regexp#to_s より自然な文字列を返します。
//emlist[例][ruby]{
p /^ugou.*?/i.to_s # => "(?i-mx:^ugou.*?)"
p /^ugou.*?/i.inspect # => "/^ugou.*?/i"
//}
@see Regexp#to_s... -
Regexp
. escape(string) -> String (27112.0) -
string の中で正規表現において特別な意味を持つ文字の直前にエ スケープ文字(バックスラッシュ)を挿入した文字列を返します。
...持つ文字の直前にエ
スケープ文字(バックスラッシュ)を挿入した文字列を返します。
@param string 正規表現において特別な意味をもつ文字をもつ文字列を指定します。
//emlist[例][ruby]{
rp = Regexp.escape("$bc^")
p rp # => "\\$bc\\^"
//}... -
Regexp
# named _ captures -> { String => [Integer] } (27100.0) -
正規表現に含まれる名前付きキャプチャ(named capture)の情報を Hash で返します。
...ャプチャ(named capture)の情報を
Hash で返します。
Hash のキーは名前付きキャプチャの名前で、値は
その名前に関連付けられたキャプチャの index のリストを返します。
//emlist[例][ruby]{
/(?<foo>.)(?<bar>.)/.named_captures
# => {"foo"=>[1], "......bar"=>[2]}
/(?<foo>.)(?<foo>.)/.named_captures
# => {"foo"=>[1, 2]}
# 名前付きキャプチャを持たないときは空の Hash を返します。
/(.)(.)/.named_captures
# => {}
//}... -
Regexp
. union(*pattern) -> Regexp (24467.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) # =>......//}
pattern は Regexp または String で与えます。
String で与えた場合、それ自身と等しい文字列にマッチするものと解釈され、
エスケープされて結果の Regexp に組み込まれます。
//emlist[][ruby]{
p Regexp.union("a", "?", "b") # => /a|\?|b/
p Re... -
Regexp
. new(string , option = nil) -> Regexp (24322.0) -
文字列 string をコンパイルして正規表現オブジェクトを生成して返します。
...を複製して返します。第二引数は警告の上無視されます。
@param string 正規表現を文字列として与えます。
@param option Regexp::IGNORECASE, Regexp::MULTILINE,
Regexp::EXTENDED
の論理和を指定します。
Integer......あれば
Regexp::IGNORECASE の指定と同じになります。
@raise RegexpError 正規表現のコンパイルに失敗した場合発生します。
//emlist[例][ruby]{
str = "This is Regexp"
t1 = Regexp.compile("this is regexp", Regexp::IGNORECASE)
t1.match(str)
p $~ # => "T......exp"
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.compil... -
Regexp
. new(string , option = nil , code = nil) -> Regexp (24322.0) -
文字列 string をコンパイルして正規表現オブジェクトを生成して返します。
...して返します。第二、第三引数は警告の上無視されます。
@param string 正規表現を文字列として与えます。
@param option Regexp::IGNORECASE, Regexp::MULTILINE,
Regexp::EXTENDED
の論理和を指定します。
Integer......ば
Regexp::IGNORECASE の指定と同じになります。
@param code "n", "N" が与えられた時には、生成された正規表現のエンコーディングは ASCII-8BIT になります。
それ以外の指定は警告を出力します。
@raise RegexpError......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_m... -
Regexp
. try _ convert(obj) -> Regexp | nil (24245.0) -
obj を to_regexp メソッドで Regexp オブジェクトに変換しようと 試みます。
...obj を to_regexp メソッドで Regexp オブジェクトに変換しようと
試みます。
変換に成功した場合はそれを返し、失敗時には nil を返します。
//emlist[例][ruby]{
Regexp.try_convert(/re/) # => /re/
Regexp.try_convert("re") # => nil
//}...