regexp.get

Description

integer/array regexp.get(object parameters)

The method allows to retrieve global regular expressions according to the given parameters.

This method is available only to Super Admin. Permissions to call the method can be revoked in user role settings. See User roles for more information.

Parameters

(object) Parameters defining the desired output.

The method supports the following parameters.

ParameterTypeDescription
regexpidsstring/arrayReturn only regular expressions with the given IDs.
selectExpressionsqueryReturn a expressions property.
sortfieldstring/arraySort the result by the given properties.

Possible values: regexpid, name.
countOutputbooleanThese parameters being common for all get methods are described in detail in the reference commentary.
editableboolean
excludeSearchboolean
filterobject
limitinteger
outputquery
preservekeysboolean
searchobject
searchByAnyboolean
searchWildcardsEnabledboolean
sortorderstring/array
startSearchboolean

Return values

(integer/array) Returns either:

  • an array of objects;
  • the count of retrieved objects, if the countOutput parameter has been used.

Examples

Retrieving global regular expressions.

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "regexp.get",
  4. "params": {
  5. "output": ["regexpid", "name"],
  6. "selectExpressions": ["expression", "expression_type"],
  7. "regexpids": [1, 2],
  8. "preservekeys": true
  9. },
  10. "id": 1
  11. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "1": {
  5. "regexpid": "1",
  6. "name": "File systems for discovery",
  7. "expressions": [
  8. {
  9. "expression": "^(btrfs|ext2|ext3|ext4|reiser|xfs|ffs|ufs|jfs|jfs2|vxfs|hfs|apfs|refs|ntfs|fat32|zfs)$",
  10. "expression_type": "3"
  11. }
  12. ]
  13. },
  14. "2": {
  15. "regexpid": "2",
  16. "name": "Network interfaces for discovery",
  17. "expressions": [
  18. {
  19. "expression": "^Software Loopback Interface",
  20. "expression_type": "4"
  21. },
  22. {
  23. "expression": "^(In)?[Ll]oop[Bb]ack[0-9._]*$",
  24. "expression_type": "4"
  25. },
  26. {
  27. "expression": "^NULL[0-9.]*$",
  28. "expression_type": "4"
  29. },
  30. {
  31. "expression": "^[Ll]o[0-9.]*$",
  32. "expression_type": "4"
  33. },
  34. {
  35. "expression": "^[Ss]ystem$",
  36. "expression_type": "4"
  37. },
  38. {
  39. "expression": "^Nu[0-9.]*$",
  40. "expression_type": "4"
  41. }
  42. ]
  43. }
  44. },
  45. "id": 1
  46. }

Source

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