|
正規表現についてRegular Expressions |
(訳注: ここで紹介されている正規表現は古い形のもので、SciTE の他では通用しないこともあるかもしれない。)
検索をするとき、文字列そのものではなく正規表現を用いて検索対象を指定することができます。例えば SciTE の属性ファイル内の変数を検索するには $(英小文字による名前) の形をしているということで \$([a-z.]+) と指定します。
Regular expressions can be used for searching for patterns
rather than literals. For example, it is possible to
search for variables in SciTE property files,
which look like $(name) with the regular expression:
\$([a-z.]+)
置換内容にも正規表現を利用でき、タグ表記による複雑な変換を行うことができます。例えば 検索対象を \([0-9]+\),\([0-9]+\)、置換内容を \2,\1 とすると、『数値甲,数値乙』 の甲乙順を逆にすることができます。
Replacement with regular expressions allows complex
transformations with the use of tagged expressions.
For example, pairs of numbers separated by a ',' could
be reordered by replacing the regular expression:
\([0-9]+\),\([0-9]+\)
with:
\2,\1
(訳注: この部分の原文はプレーンテキストから HTML 化する際に失敗したらしい。)
例: 合致するもの:
[a-z] 小文字アルファベットのどれか
[^]-] ] と - を除く文字なら何でも合致
[^A-Z] 大文字アルファベットでなければ合致
[a-zA-Z] アルファベットが合致
[set] matches one of the characters in the set.
If the first character in the set is "^",
it matches a character NOT in the set, i.e.
complements the set. A shorthand S-E is
used to specify a set of characters S up to
E, inclusive. The special characters "]" and
"-" have no special meaning if they appear
as the first chars in the set.
examples: match:
[a-z] any lowercase alpha
[^]-] any char except ] and -
[^A-Z] any char except uppercase
alpha
[a-zA-Z] any alpha
この文書の原文は Ozan S. Yigit によって記述されました。
Neil Hodgson が追加の記述を行いました。
この文書のすべてはパブリックドメインです。
Most of this documentation was originally written by Ozan S. Yigit.
Additions by Neil Hodgson.
All of this document is in the public domain.