Skip to content

Regex

Pattern matching: match, extract, replace, split, and test.

5 modules

ModuleDescription
Regex ExtractExtract named groups from text
Regex MatchFind all matches of a pattern in text
Regex ReplaceReplace pattern matches in text
Regex SplitSplit text by a regex pattern
Regex TestTest if string matches a regex pattern

Modules

Regex Extract

regex.extract

Extract named groups from text

Parameters:

NameTypeRequiredDefaultDescription
textstringYes-Text to extract from
patternstringYes-Text to extract from
ignore_casebooleanNoFalseCase-insensitive matching

Output:

FieldTypeDescription
extractedobjectCase-insensitive matching
matchedbooleanExtracted named groups
full_matchstringExtracted named groups

Regex Match

regex.match

Find all matches of a pattern in text

Parameters:

NameTypeRequiredDefaultDescription
textstringYes-Text to search
patternstringYes-Text to search
ignore_casebooleanNoFalseRegular expression pattern
first_onlybooleanNoFalseCase-insensitive matching

Output:

FieldTypeDescription
matchesarrayReturn only the first match
countnumberList of matches
groupsarrayList of matches

Regex Replace

regex.replace

Replace pattern matches in text

Parameters:

NameTypeRequiredDefaultDescription
textstringYes-Text to process
patternstringYes-Text to process
replacementstringYes-Regular expression pattern
ignore_casebooleanNoFalseReplacement text (supports backreferences)
countnumberNo0Case-insensitive matching

Output:

FieldTypeDescription
resultstringMaximum replacements (0 = unlimited)
replacementsnumberText with replacements
originalstringText with replacements

Regex Split

regex.split

Split text by a regex pattern

Parameters:

NameTypeRequiredDefaultDescription
textstringYes-Text to split
patternstringYes-Text to split
ignore_casebooleanNoFalseRegular expression pattern for delimiter
max_splitnumberNo0Case-insensitive matching
remove_emptybooleanNoFalseMaximum number of splits (0 = unlimited)

Output:

FieldTypeDescription
resultarrayRemove empty strings from result
countnumberSplit parts

Regex Test

regex.test

Test if string matches a regex pattern

Parameters:

NameTypeRequiredDefaultDescription
textstringYes-Text to test
patternstringYes-Text to test
ignore_casebooleanNoFalseRegular expression pattern
full_matchbooleanNoFalseCase-insensitive matching

Output:

FieldTypeDescription
resultbooleanRequire pattern to match entire string
patternstringWhether pattern matches

Released under the Apache 2.0 License.