regexp.create
Description
object regexp.create(object/array regularExpressions)
This method allows to create new global regular expressions.
This method is only available to Super admin user types. Permissions to call the method can be revoked in user role settings. See User roles for more information.
Parameters
(object/array)
Regular expressions to create.
Additionally to the standard properties, the method accepts the following parameters.
Parameter | Type | Description |
---|---|---|
expressions | array | Expressions options. |
Return values
(object)
Returns an object containing the IDs of the created regular expressions under the regexpids
property.
Examples
Creating a new global regular expression.
Request:
{
"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"
}
]
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}
Response:
{
"jsonrpc": "2.0",
"result": {
"regexpids": [
"16"
]
},
"id": 1
}
Source
CRegexp::create() in ui/include/classes/api/services/CRegexp.php.