種類
- 文書 (38)
- 特異メソッド (24)
- インスタンスメソッド (12)
- ライブラリ (12)
ライブラリ
-
rexml
/ document (36)
クラス
-
REXML
:: Elements (12) -
REXML
:: Entity (12) -
REXML
:: XPath (12)
キーワード
-
NEWS for Ruby 2
. 4 . 0 (9) -
NEWS for Ruby 3
. 0 . 0 (5) - matches? (12)
-
rexml
/ document (12) -
ruby 1
. 9 feature (12) -
to
_ a (12) - 正規表現 (12)
検索結果
先頭5件
-
REXML
:: XPath . match(element , path = nil , namespaces = {} , variables = {}) -> [Node] (18248.0) -
element の path で指定した XPath 文字列にマッチするノードの配列を 返します。
...element の path で指定した XPath 文字列にマッチするノードの配列を
返します。
path に相対パスを指定した場合は element からの相対位置で
マッチするノードを探します。
絶対パスを指定した場合は element が属する文書のルー......。
XPathインジェクション攻撃を避けるため、適切な
エスケープを付加するため、に用います。
@param element 要素(REXML::Element)
@param path XPath文字列
@param namespace 名前空間とURLの対応付け
@param variables 変数名とその値の対応付け......//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<root xmlns:x='1'>
<a>
<b>b1</b>
<x:c />
<b>b2</b>
<d />
</a>
<b> b3 </b>
</root>
EOS
REXML::XPath.match(doc, "/root/a/b") # => [<b> ... </>, <b> ... </>]
//}... -
REXML
:: Entity . matches?(string) -> bool (6106.0) -
string が実体宣言の文法に従う文字列であれば真を返します。
...あれば真を返します。
@param string 判定対象の文字列
//emlist[][ruby]{
require 'rexml/document'
p REXML::Entity.matches?('<!ENTITY s "seal">') # => true
p REXML::Entity.matches?('<!ENTITY % s "seal">') # => true
p REXML::Entity.matches?('<!ELEMENT br EMPTY >') # => false
//}... -
REXML
:: Elements # to _ a(xpath = nil) -> [REXML :: Element] (3113.0) -
すべての子要素の配列を返します。
...REXML::Elements#each と同様、REXML::XPath.match などと
異なり、要素以外の子ノードは無視されます。
@param xpath XPath文字列
//emlist[][ruby]{
require 'rexml/document'
require 'rexml/xpath'
doc = REXML::Document.new '<a>sean<b/>elliott<c/></a>'
doc.root.elements.to_a......# => [<b/>, <c/>]
doc.root.elements.to_a("child::node()") # => [<b/>, <c/>]
REXML::XPath.match(doc.root, "child::node()") # => ["sean", <b/>, "elliott", <c/>]
//}... -
正規表現 (450.0)
-
正規表現 * metachar * expansion * char * anychar * string * str * quantifier * capture * grouping * subexp * selector * anchor * cond * option * encoding * comment * free_format_mode * absenceop * list * specialvar * references
...lace}/.match("Go to 東京都") # => #<MatchData "東京都">
//}
埋め込んだ文字列にメタ文字が含まれているならば、それは
メタ文字として認識されます。
//emlist[][ruby]{
number = "(\\d+)"
operator = "(\\+|-|\\*|/)"
/#{number}#{operator}#{number}/.match("43+29......1")
# => #<MatchData "43+291" 1:"43" 2:"+" 3:"291">
//}
埋め込む文字列をリテラルとして認識させたい場合は Regexp.quote を
使います。
===[a:char] 文字
正規表現内では、「\」の後に文字列を置くことで、
ある特定の文字を表現することが......(?:(?<b>.)\g<a>\k<b+0>))\z/.match("rekxker")
# => #<MatchData "rekxker" a:"rekxker" b:"k">
//}
以下の例では、開始タグと終了タグを対応付ける正規表現です。
//emlist[][ruby]{
r = Regexp.compile(<<'__REGEXP__'.strip, Regexp::EXTENDED)
(?<element> \g<stag> \g<content>* \g<e... -
rexml
/ document (42.0) -
DOM スタイルの XML パーサ。
...ks = REXML::XPath.match(doc, "/xbel/bookmark").map do |bookmark|
href = bookmark.attribute("href").value
title_element = bookmark.elements["title"]
title = title_element ? title_element.text : nil
desc_element = bookmark.elements["desc"]
desc = desc_element ? desc_element.text : nil
Boo... -
NEWS for Ruby 2
. 4 . 0 (30.0) -
NEWS for Ruby 2.4.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...Kernel#clone は freeze というキーワード引数を受け付けるようになりました。
12300
* MatchData
* MatchData#named_captures を追加 11999
* MatchData#values_at は named captures をサポートするようになりました 9179
* Module
* Module#refin......ven, :up, :down が指定可能です。12953
* Regexp
* meta character \X matches Unicode 9.0 characters with some workarounds
for UTR #51 Unicode Emoji, Version 4.0 emoji zwj sequences.
* Regexp#match? を追加 8110
true/false を返し、バックリファレンスを生......追加 12596
* readline
* Readline.quoting_detection_proc, Readline.quoting_detection_proc= を追加
12659
* rexml
* REXML::Element#[] : If String or Symbol is specified, attribute
value is returned. Otherwise, Nth child is returned. This is
backward compatible chang... -
ruby 1
. 9 feature (30.0) -
ruby 1.9 feature ruby version 1.9.0 は開発版です。 以下にあげる機能は将来削除されたり互換性のない仕様変更がなされるかもしれません。 1.9.1 以降は安定版です。 バグ修正がメインになります。
...16833>))
((<URL:http://eigenclass.org/hiki.rb?Changes+in+Ruby+1.9+update+4>))
=== 2006-05-22
: accept
((<ruby-core:7917>))
=== 2006-03-21
: MatchData#[] [compat]
名前による参照
((<ruby-dev:28446>))
=== 2006-03-03
: FileUtils.cp_r [lib] [compat]
remove_destination オプシ......S Parser/Maker [lib] [new]
((<Imageモジュール|URL:http://web.resource.org/rss/1.0/modules/image/>))のサポート
=== 2005-02-03
: RSS::Element#convert(value) [lib] [new]
valueのエンコーディングを変換するメソッドを公開。
valueのエンコーディングは......=== 2004-07-17
: Regexp#match(str, [pos]) [compat]
: String#match(re, [pos]) [compat]
省略可能な第二引数 pos が追加されました。マッチの開始位置を指定しま
す。((<ruby-core:03203>)), ((<ruby-core:03205>))
p(/(.)/.match("foobar", 4).captures)... -
NEWS for Ruby 3
. 0 . 0 (24.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...entError or different behavior. 14183
* Procs accepting a single rest argument and keywords are no longer
subject to autosplatting. This now matches the behavior of Procs
accepting a single rest argument and no keywords.
16166
//emlist[][ruby]{
pr = proc{|*a, **kw| [a, kw]}
pr.call(......guments.
16378
//emlist{
def method_missing(meth, ...)
send(:"do_#{meth}", ...)
end
//}
* Pattern matching (`case/in`) is no longer experimental. 17260
* One-line pattern matching is redesigned. [EXPERIMENTAL]
* `=>` is added. It can be used like a rightward assignment.......tor::ArithmeticSequence
//emlist[][ruby]{
dirty_data = ['--', 'data1', '--', 'data2', '--', 'data3']
dirty_data[(1..).step(2)] # take each second element
# => ["data1", "data2", "data3"]
//}
* Binding
* Binding#eval when called with one argument will use `"(eval)"` for `__FILE__` and `1` for...