Query Manipulation Server 26.2
Query Manipulation Server Help

# getFieldsByRegex

The `getFieldsByRegex` method returns all document fields where the field name or path matches a regular expression.

## Syntax

    getFieldsByRegex( regex [, recursive [, matchFullPath [, caseSensitive ]]])

## Arguments

Argument | Description
--- | ---
`regex` | (string) The regular expression to match field names or paths against.
`recursive` | (boolean, default `true`) Specifies whether to search recursively. If you set this argument to `false`, the method only returns fields at the root of the document.
`matchFullPath` | (boolean, default `true`) Specifies whether to match against the full path of the field. If you set this argument to `false`, the regular expression has to match only the field name.
`caseSensitive` | (boolean, default `true`) Specifies whether matching is case-sensitive.

## Returns

(LuaFields) A list of LuaField objects where each LuaField represents a matching field. To map the returned fields to a table, surround the function call with braces as shown in the following example.

## Example

    local fields = { document:getFieldsByRegex("Prefix_.*", true, false, false) }
    for i, field in ipairs(fields) do
        print field:value()
    end

Copyright 2026 Open Text
Version 26.2 | Last updated April 2026

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: Knowledge Discovery Query Manipulation Server 26.2

Topic Title: getFieldsByRegex