# getFieldsByRegex

The `getFieldsByRegex` method returns all sub fields where the sub field name or path (relative to this field) 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 that are direct descendants of this field.
`matchFullPath` | (boolean, default `true`) Specifies whether to match against the path of the sub field (relative to the field the method is called on). If you set this argument to `false`, the regular expression only has to match 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 = { myField:getFieldsByRegex("Prefix_.*", true, false, false) }
    for i, field in ipairs(fields) do
        print field:value()
    end

© Copyright 2016-2020 Micro Focus or one of its affiliates | Send documentation feedback Close Send documentation feedback To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a mail client, and then send this email to swpdl.idoldocsfeedback@microfocus.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_FT_HTML5_bannerTitle.htm