> ## Documentation Index
> Fetch the complete documentation index at: https://docs.arc.cdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 検索フォーマッタ

> ArcScript で文字列値の検索、マッチング、測定を行うフォーマッタ。

## count(substring)

最初のパラメータで指定した部分文字列が、属性値内に出現する回数を返します。

* **substring**：属性値内で検索する部分文字列。

## endswith(substring\[, iftrue]\[, iffalse])

属性値が指定したパラメータで終わるかどうかを判定します。属性がその値で終わる場合は *true*（または *iftrue*）を返し、そうでない場合は *false*（または *iffalse*）を返します。

* **substring**：末尾に期待される文字列。
* **iftrue**：属性値がパラメータ値で終わる場合に返される任意の値。
* **iffalse**：属性値がパラメータ値で終わらない場合に返される任意の値。

## find(target\[, startindex])

入力文字列を検索し、*target* がこの文字列内で最初に出現する位置（ゼロベースのインデックス）を返します。

*startindex* が指定された場合、フォーマッタは入力文字列内のこのインデックスから *target* の検索を開始します（言い換えると、*startindex* より前に出現する *target* のインスタンスは無視されます）。

### 例

```xml theme={null}
<arc:set attr="myString" value="Please excuse my dear Aunt Sally." />
<arc:set attr="whereIsSally" value="[myString | find('Sally')]" />
<!-- whereIsSally has the value: 27 -->
```

## getlength()

入力属性内の文字数を返します。

### 例

```xml theme={null}
<arc:set attr="myString" value="hello world" />
<arc:set attr="stringLength" value="[myString | getlength()]" />
```

## match(pattern\[, index]\[, option])

属性値が表す文字列を検索し、*pattern* パラメータで指定された正規表現に一致する箇所を探します。

* **pattern**：マッチさせる正規表現パターン。
* **index**：返すマッチの番号付きインデックス（任意）。デフォルトは `0` です。
* **option**：正規表現オプションのカンマ区切りリスト（任意）。よく使用されるオプションには IgnoreCase、Multiline、Singleline、IgnorePatternWhitespace などがあります。

## regexmatch(pattern\[, index]\[, option])

入力文字列を *pattern* で指定した正規表現パターンで検索し、そのパターンに一致する最初の文字の集合を返します。

* **pattern**：マッチさせる正規表現パターン。
* **index**：返すマッチの番号付きインデックス（任意）。デフォルトは `0` です。
* **option**：正規表現オプションのカンマ区切りリスト（任意）。よく使用されるオプションには IgnoreCase、Multiline、Singleline、IgnorePatternWhitespace などがあります。

### 例

```xml theme={null}
<arc:set attr="myString" value="The cost of the item is $12.98." />
<arc:set attr="decimalPattern" value="\[0-9\]+\.?\[0-9\]*" />
<arc:set attr="price" value="[myString | regexmatch([decimalPattern])]" />
<!-- price has the value: 12.98 -->
```
