るりまサーチ

最速Rubyリファレンスマニュアル検索!
22件ヒット [1-22件を表示] (0.021秒)
トップページ > クエリ:Regexp[x] > クエリ:fixed_encoding?[x]

別のキーワード

  1. regexp fixed_encoding?
  2. _builtin fixed_encoding?
  3. fixed_encoding?
  4. fixed_encoding? regexp
  5. fixed_encoding? _builtin

ライブラリ

クラス

検索結果

Regexp#fixed_encoding? -> bool (39119.0)

正規表現が任意の ASCII 互換エンコーディングとマッチ可能な時に false を返します。

...CII 互換エンコーディングとマッチ可能な時に false を返します。

//emlist[例][ruby]{
# -*- coding:utf-8 -*-

r = /a/
r.fixed_encoding? # => false
r.encoding # => #<Encoding:US-ASCII>
r =~ "\u{6666} a"...
...# => 2
r =~ "\xa1\xa2 a".force_encoding("euc-jp") # => 2
r =~ "abc".force_encoding("euc-jp") # => 0

r = /a/u
r.fixed_encoding? # => true
r.encoding # => #<Encoding:UTF-8>
r =~ "\u{6666} a"...
...# => Encoding::CompatibilityError
end
r =~ "abc".force_encoding("euc-jp") # => 0

r = /\u{6666}/
r.fixed_encoding? # => true
r.encoding # => #<Encoding:UTF-8>
r =~ "\u{6666} a"...

正規表現 (3174.0)

正規表現 * metachar * expansion * char * anychar * string * str * quantifier * capture * grouping * subexp * selector * anchor * cond * option * encoding * comment * free_format_mode * absenceop * list * specialvar * references

...文字列中のどの場所であるかを知ることができます。

//emlist[][ruby]{
/pat/
%r{pat}
//}

などの正規表現リテラルや Regexp.new などで正規表現
オブジェクトを得ることができます。


===[a:metachar] メタ文字列とリテラル、メタ文字と...
...er}/.match("43+291")
# => #<MatchData "43+291" 1:"43" 2:"+" 3:"291">
//}

埋め込む文字列をリテラルとして認識させたい場合は Regexp.quote を
使います。

===[a:char] 文字
正規表現内では、「\」の後に文字列を置くことで、
ある特定の文字を表...
...、Encoding::CompatibilityError が発生します。

エンコーディングについては spec/m17n も参考にしてください。

Regexp
#fixed_encoding? で正規表現のエンコーディングが
「固定」さているかどうかを調べることができます。
これが真であ...