[comment]: # ({acf00dc8-acf00dc8})
# 创建

[comment]: # ({/acf00dc8-acf00dc8})

[comment]: # ({7f99f0b4-3c60fab5})
### 描述

`object regexp.create(object/array regularExpressions)`

此方法允许创建新的全局正则表达式。

::: noteclassic
此方法仅适用于 *超级管理员* 用户类型。
调用此方法的权限可在用户角色设置中撤销。更多信息请参见
[用户角色](/manual/web_interface/frontend_sections/users/user_roles)。
:::

[comment]: # ({/7f99f0b4-3c60fab5})

[comment]: # ({fe0b3b61-f518ef9f})
### 参数

`(object/array)` 要创建的正则表达式。

除了[标准属性](object)外，该方法还接受以下参数。

|参数|[类型](/manual/api/reference_commentary#data-types)|说明|
|--|--|------|
|expressions|array|[Expressions](/manual/api/reference/regexp/object#expressions) 选项。<br><br>[参数行为](/manual/api/reference_commentary#parameter-behavior):<br>- *必需*|

[comment]: # ({/fe0b3b61-f518ef9f})

[comment]: # ({f0011f1b-f0011f1b})
### 返回值

`(object)` 返回一个对象，其中包含`regexpids`属性下创建的正则表达式的ID。

[comment]: # ({/f0011f1b-f0011f1b})

[comment]: # ({b41637d2-b41637d2})
### 示例

[comment]: # ({/b41637d2-b41637d2})

[comment]: # ({87169e24-3d653b4d})
#### 创建一个新的全局正则表达式。

[请求](/manual/api#执行请求):

```json
{
	"jsonrpc": "2.0",
	"method": "regexp.create",
	"params": {
		"name": "Storage devices for SNMP discovery",
		"test_string": "/boot",
		"expressions": [{
			"expression": "^(Physical memory|Virtual memory|Memory buffers|Cached memory|Swap space)$",
			"expression_type": "4",
			"case_sensitive": "1"
		}]
	},
	"id": 1
}
```

响应：

```json
{
	"jsonrpc": "2.0",
	"result": {
		"regexpids": [
			"16"
		]
	},
	"id": 1
}
```

[comment]: # ({/87169e24-3d653b4d})

[comment]: # ({cf9f5f19-cf9f5f19})
### 参考来源

CRegexp::create() in *ui/include/classes/api/services/CRegexp.php*.

[comment]: # ({/cf9f5f19-cf9f5f19})
