正規表現のリスト

記号

作用と用途

すべての文字

指定しない場合、所定の文字列を表します。

.

行ブレークと段落ブレーク以外のすべての単一文字を表します。たとえば、検索語として「sh.rt」を指定すると、「shirt」と「short」の両方が戻されます。

^

検索語句が段落の先頭にある場合にのみ検索されます。段落の先頭にある特殊オブジェクト (空のフィードや文字にアンカーされた枠) は無視されます。たとえば、「^Peter」です。

$

検索語句が段落の末尾にある場合にのみ検索されます。段落の末尾にある特殊なオブジェクト (空のフィールドや文字にアンカーされた枠) は無視されます。たとえば、「Peter$」などです。

$ on its own matches the end of a paragraph. This way it is possible to search and replace paragraph breaks.

*

「*」の前の文字が 0 個以上の語句が検索されます。例えば「Ab*c」では、「Ac」、「Abc」、「Abbc」、「Abbbc」などが検索されます。

+

「+」記号の前の文字が 1 個以上の語句が検索されます。たとえば、「AX.+4」とすると「AX 4」は検索されますが「AX4」は検索されません。

段落内で可能な限り長いテキストが常に検索されます。段落にテキスト「AX 4 AX4」が含まれている場合、先頭の A から末尾の 4 までが検索されます。

?

「?」 の直前にある文字が0回または1回出現することを示します。たとえば 「テキ?ト」 と指定すると 「テスト」 と 「テキスト」 が検索されます。「x(ab|c)?y」 と指定すると 「xaby」 や 「xcy」 が検索されます。

\

正規表現ではなく、通常の文字として「\」の後ろに続く特殊文字を検索します (\n、 \t、 \>、 \< の組み合わせは除きます)。たとえば「tree\.」は、「tree.」を検索します。「treed」あるいは「trees」などは検索できません。

\n

Represents a line break that was inserted with the Shift+Enter key combination. To change a line break into a paragraph break, enter \n in the Find and Replace boxes, and then perform a search and replace.

\n in the Find text box stands for a line break that was inserted with the Shift+Enter key combination.

\n in the Replace text box stands for a paragraph break that can be entered with the Enter or Return key.

\t

Represents a tab. You can also use this expression in the Replace box.

\b

Match a word boundary. For example, "\bbook" finds "bookmark" but not "checkbook" whereas "book\b" finds "checkbook" but not "bookmark". The discrete word "book" is found by both search terms.

^$

空の段落が検索されます。

^.

段落の最初の文字が検索されます。

& または $0

Adds the string that was found by the search criteria in the Find box to the term in the Replace box when you make a replacement.

For example, if you enter "window" in the Find box and "&frame" in the Replace box, the word "window" is replaced with "windowframe".

You can also enter an "&" in the Replace box to modify the Attributes or the Format of the string found by the search criteria.

[abc123]

かっこで囲まれた文字の 1 つを表します。

[a-e]

Represents any of the characters that are between a and e, including both start and end characters.

文字の順序は文字コードの番号順です。

[a-eh-x]

Represents any of the characters that are between a-e and h-x.

[^a-s]

Represents everything that is not between a and s.

\uXXXX

\UXXXXXXXX

Represents a character based on its four-digit hexadecimal Unicode code (XXXX).

For obscure characters there is a separate variant with capital U and eight hexadecimal digits (XXXXXXXX).

For certain symbol fonts the code for special characters may depend on the used font. You can view the codes by choosing Insert - Special Character.

|

「|」より前の条件で検索して、その後に「|」より後の条件で検索します。例えば、「これ | それ」は「これ」と「それ」を検索します。

{2}

開きかっこの左側にある文字の発生回数を指定します。例えば「tre{2}」を指定すると、「tree」が検索されます。

{1,2}

開きかっこの前にある文字の繰りかえしの最小回数と最大回数を指定します。たとえば、「tre{1,2}」と指定すると、「tre」、および「tree」が検索されます。

{1,}

左角括弧の前にある文字の繰りかえしの最小回数を指定します。たとえば、「tre{2,}」と指定すると、「tree」、「treee」、および「treeeee」が検索されます。

( )

In the Find box:

かっこ内の文字を参照対象として定義します。すると、現在の式で最初の参照対象を「\1」、第 2 の参照対象を「\2」、以降同様にして参照することができます。

For example, if your text contains the number 13487889 and you search using the regular expression (8)7\1\1, "8788" is found.

You can also use () to group terms, for example, "a(bc)?d" finds "ad" or "abcd".

In the Replace box:

Use $ (dollar) instead of \ (backslash) to replace references. Use $0 to replace the whole found string.

[:alpha:]

Represents an alphabetic character. Use [:alpha:]+ to find one of them.

[:digit:]

Represents a decimal digit. Use [:digit:]+ to find one of them.

[:alnum:]

英数文字 ([:alpha:] と [:digit:]) を表します。

[:space:]

空白文字です (その他の空白類文字ではありません)。

[:print:]

プリント可能文字を表します。

[:cntrl:]

編集記号を表します。

[:lower:]

オプション大文字と小文字を区別する がオンにされていると、小文字を検索します。

[:upper:]

Represents an uppercase character if Match case is selected in Options.


For a full list of supported metacharacters and syntax, see ICU Regular Expressions documentation

e([:digit:])? -- finds 'e' followed by zero or one digit. Note that currently all named character classes like [:digit:] must be enclosed in parentheses.

^([:digit:])$ -- finds lines or cells with exactly one digit.

検索語を組み合わせて、複雑な検索を作成できます。

段落内の 3 桁の数字だけを検索する

^[:digit:]{3}$

「^」は、段落の先頭で一致しなければならないことを意味しています。

[:digit:]10 進数の数字と一致します。

{3} は、正確に 3 コピーの「桁」でなければならないことを意味しています。

「$」は段落の最後で一致しなければならないことを意味します。