Skip to content

Commit

Permalink
doc: Improve document about absence operator (Issue #87)
Browse files Browse the repository at this point in the history
Rename absent operator to absence operator.
Add more description.
  • Loading branch information
k-takata committed Apr 5, 2017
1 parent 5210069 commit 7911409
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion doc/RE
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,12 @@ syntax: ONIG_SYNTAX_RUBY (default)
left-most group is checked, but it should be the
same as \k<name>.

(?~subexp) absent operator (experimental)
(?~subexp) absence operator (experimental)
Matches any string which doesn't contain any string which
matches subexp.
More precisely, (?~subexp) matches the complement set of
a set which .*subexp.* matches. This is regular in the
meaning of formal language theory.
Similar to (?:(?!subexp).)*, but easy to write.

E.g.:
Expand Down
4 changes: 3 additions & 1 deletion doc/RE.ja
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,9 @@

(?~式) 非包含オペレータ (実験的)
式にマッチする文字列を含まない任意の文字列にマッチする。
(?:(?!subexp).)* と似ているが簡単に書ける。
より正確には、(?~式) は、.*式.* がマッチする集合の補集合に
マッチする。これは形式言語理論の意味で正規である。
(?:(?!式).)* と似ているが簡単に書ける。

例:
(?~abc) は以下にマッチする: "", "ab", "aab", "ccdd" 等
Expand Down

0 comments on commit 7911409

Please sign in to comment.