From f37f9a8e2d8a3af1dedd8445c0a2647231b429fb Mon Sep 17 00:00:00 2001 From: "K.Kosako" Date: Fri, 14 Jul 2017 15:37:38 +0900 Subject: [PATCH] update doc/RE for absent group --- doc/RE | 15 ++++++++++++++- doc/RE.ja | 21 ++++++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/doc/RE b/doc/RE index 354d7cd..c899dbd 100644 --- a/doc/RE +++ b/doc/RE @@ -1,4 +1,4 @@ -Oniguruma Regular Expressions Version 6.5.0 2017/07/13 +Oniguruma Regular Expressions Version 6.5.0 2017/07/14 syntax: ONIG_SYNTAX_RUBY (default) @@ -240,6 +240,19 @@ syntax: ONIG_SYNTAX_RUBY (default) Assigning the same name to two or more subexps is allowed. + (?~absent_exp) Absent group (* proposed by Tanaka Akira) + This works like ".*", but it is limited by the range that + does not include the string match with absent_exp. + ".*" is used as a default generator. + Therefore this is affected by the multi-line option (?m). + + (?~|generator|absent_exp) Absent group with custom generator (* original) + Generator must be a greedy or possessive quantifier. + + ex. (?~|\d*|345) + (?~|(?:abc|de|f){0,100}|def) + + (?(condition_exp)then_exp|else_exp) if-then-else (?(condition_exp)then_exp) if-then diff --git a/doc/RE.ja b/doc/RE.ja index d908e10..61630fe 100644 --- a/doc/RE.ja +++ b/doc/RE.ja @@ -1,4 +1,4 @@ -鬼車 正規表現 Version 6.5.0 2017/07/13 +鬼車 正規表現 Version 6.5.0 2017/07/14 使用文法: ONIG_SYNTAX_RUBY (既定値) @@ -242,6 +242,25 @@ この場合には、この名前を使用した後方参照は可能であるが、 部分式呼出しはできない。 + (?~不在式) 不在式集合 (* 原案 田中哲) + これは".*"のように動作するが、absent_expに適合する文字列を + 含まない範囲に制限される。 + ".*"が既定の生成子として使用される。 + そのため、マルチラインオプション(?m)の影響を受ける。 + + 不在式が長さ0でマッチングする可能性があれば、常に失敗する。 + (返せる文字列範囲が存在しないので、これは正当な動作である) + + (?~|生成子|不在式) 生成子付き不在式集合 (* 原作) + 生成子は貪欲あるいは強欲な量指定子でなければならない。 + + 例. (?~|\d*|345) + (?~|(?:abc|de|f){2,100}|def) + + * 量指定子の最低回数が0より大きい場合は、都合により生成される + バイトコードが非効率なものにならざるを得ないので、 + 0にすることを勧める。 + (?(条件式)成功式|失敗式) 条件式が成功すれば成功式、失敗すれば失敗式を実行する この機能の存在理由は、成功式が失敗しても失敗式には 行かないこと。これは他の正規表現で書くことができない。 -- 2.40.0