FTP Connector 12.12

# regex_match

The `regex_match` method performs a regular expression match on a string.

## Syntax

    regex_match( input, regex [, case] )

## Arguments

Argument | Description
--- | ---
`input` | (string) The string to match.
`regex` | (string) The regular expression to match against.
`case` | (boolean) A boolean that specifies whether the match is case-sensitive. The match is case sensitive by default (`true`).

## Returns

One or more strings, or `nil`.

If the string matches the regular expression, and the regular expression has no sub-matches, the full string is returned.

If the string matches the regular expression, and the regular expression has sub-matches, then only the sub-matches are returned.

If the string does not match the regular expression, there are no return values (any results are `nil`).

You can assign multiple strings to a table. To assign the return values to a table, surround the function call with braces. For example:

    matches = { regex_match( input, regex ) }

## Examples

    local r1, r2, r3 = regex_match( "abracadabra", "(a.r)((?:a.)*ra)" )

Results: `r1="abr"`, `r2="acadabra"`, `r3=nil`

    local r1, r2, r3 = regex_match( "abracadabra", "a.r(?:a.)*ra" )

Results: `r1="abracadabra"`, `r2=nil`, `r3=nil`

© Copyright 2022 Micro Focus or one of its affiliates
Version 12.12 | Last updated June 2022

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 swpdl.idoldocsfeedback@microfocus.com.

We appreciate your feedback!

Product: IDOL FTP Connector 12.12

Topic Title: regex_match