Regex

 

 

 

Regex

 

Description

Returns the result of a regular expression match against a value expression.

 

Arguments

1.Regex - Name of the Macro.

2.Input Value - The value expression to search in.

3.Pattern - The regular expression to search for in the input value. NOTE: escape values when used in macro expressions.

4.Case Sensitive - If set to true searches are case-sensitive; otherwise they are not (the default).

5.Failure Result - If the regular expression does not result in a match this value will be returned instead of an empty string.

6.Success Result - If the regular expression results in a match this value will be returned instead of the matched value.

 

Examples

<Regex|SAMPLE.XLS|\.(txt%|xlsx?)$>

Returns the value .XLS from a successful regular expression match.

 

<Regex|SAMPLE.XLS|^.*\.(txt%|xlsx?)$|True>

Returns the value SAMPLE.XLS from a successful regular expression match.

 

<Regex|SAMPLE.XLS|\.csv$||No match|Match>

Returns the value No match because no match was made.

 

<Regex|A-B-C-D|^(\w)-(\w)-(\w)-(\w)$|False|No Match|Match|3>

Returns the value C because it was in the second matching group of a successful regular expression match.

 

<Regex|A-B-C-D|^(\w)-(\w)-(\w)-(\w)$|False|No Match|Match|5>

Returns the value Match because a match was made but the matching group did not exist.

 

<Regex|Company: Acme, Product: Anvil|Company: (.*), Product: (.*)|True|No Match|Match|1>

Returns the value Acme because it was in the first matching group of a successful regular expression match.

 

<Regex|TrialBalance-05-14-2021.XLSX|^([a-z]+)-(\d{2}-\d{2}-\d{4})\.([a-z0-9]+)$|False|No Match|Match|2>

Returns the value 05-14-2021 because it was in the second matching group of a successful regular expression match.

 

Notes

Make sure you use the correct escape characters if regular expressions are used in macro-able locations.

 


Copyright © 2024 pasUNITY, Inc.

 

Send comments on this topic.