# template

URL: https://caijiao.org/radash/string/template
Source: docs/radash/string/template.md
Description: 使用搜索表达式用数据对象中的值模板化字符串 给定一个字符串、一个数据对象和一个要搜索的格式表达式，返回一个字符串，其中所有匹配搜索的元素都被数据对象中匹配的值替...

使用搜索表达式用数据对象中的值模板化字符串


## 基本用法

给定一个字符串、一个数据对象和一个要搜索的格式表达式，返回一个字符串，其中所有匹配搜索的元素都被数据对象中匹配的值替换。

```ts
import { template } from 'radash'

template('It is {{color}}', { color: 'blue' }) // => It is blue
template('It is <color>', { color: 'blue' }, /<(.+?)>/g) // => It is blue
```
