Open topic with navigation

# 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`

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

_FT_HTML5_bannerTitle.htm