[comment]: # translation:outdated

[comment]: # ({ffe55246-ffe55246})
# 正则表达式.更新

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

[comment]: # ({36b89e71-596faacb})
### 说明

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

该方式允许用户升级已创建的全局性正则表达式。

::: noteclassic
该方式仅对*超级管理员*类型的用户生效。 用户可以在用户职责设置中对该方式的使用权限进行设定修改。请参考 [用户角色](zh/manual/web_interface/frontend_sections/administration/user_roles)以获取更多信息。
:::

[comment]: # ({/36b89e71-596faacb})

[comment]: # ({b570fe52-f26d83f8})
### 参数

`(object/array)`将更新的正则表达式属性。

`regexpid`为必要配置参数，需要为每一个正则表达式配置，其它属性为可选配置参数。 只有符合要求的属性才会被直接升级，若不符合则原属性将保持不变。

除此之外，根据[标准属性](object#expressions_object)，该方式支持以下参数。

|参数名称|[类型](zh/manual/api/reference_commentary#data_types)|说明|
|---------|---------------------------------------------------|-----------|
|expressions|数组|[表达式](zh/manual/api/reference/regexp/object#expressions_object) 选项。|

[comment]: # ({/b570fe52-f26d83f8})

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

根据`regexpids`的特性，`(object)` 会返回一个对象，其包含已升级的正则表达式ID。

[comment]: # ({/7a7252f7-7a7252f7})

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

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

[comment]: # ({52b077ee-aef504e5})
#### 更新自动发现文件系统的全局正则表达式。

请求：

```json
{
    "jsonrpc": "2.0",
    "method": "regexp.update",
    "params": {
      "regexpid": "1",
      "name": "File systems for discovery",
      "test_string": "",
      "expressions": [
        {
          "expression": "^(btrfs|ext2|ext3|ext4|reiser|xfs|ffs|ufs|jfs|jfs2|vxfs|hfs|apfs|refs|zfs)$",
          "expression_type": "3",
          "exp_delimiter": ",",
          "case_sensitive": "0"
        },
        {
          "expression": "^(ntfs|fat32|fat16)$",
          "expression_type": "3",
          "exp_delimiter": ",",
          "case_sensitive": "0"
        }
      ]
    },
    "auth": "700ca65537074ec963db7efabda78259",
    "id": 1
}
```

响应：

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

[comment]: # ({/52b077ee-aef504e5})

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

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

[comment]: # ({/90c4873e-90c4873e})
