Wilcards in ArrayContains formula for Column Expression Node

I’ve created the following code in a Column Expression node:

if ( arrayContains(columns(columnNames()), "Check Amount:  $") )
{ 
column(arrayIndexOf(columns(columnNames()), "Check Amount:  $")+1) 
}

This works great at returning the cell to the right of “Check Amount: $”. However, I have a number of files and some of them write that cell without the dollar sign and extra spaces, like: “Check Amount” or “Check Amount:”. Is there a way to add wildcards to this formula, so that ArrayContains looks for something like “Check Amount*”? Or using regular expressions, so it looks for something like:

".*Check Amount.*" ?

I’ve tried combining the RegexMatcher formula with ArrayContains, but I can’t figure out how to do it properly.

Hello @stevelp,

Don’t think so. But you can try following approach with String Manipulation (Multi Column) node:
regexReplace(toEmpty(string($$CURRENTCOLUMN$$)),".*Check Amount.*","Check Amount Found")

After it you can use your approach in Column Expressions node on Check Amount Found or whatever you define in above function. Functions toEmpty() and string() are here to make sure expression can be applied to all columns regardless of type and missing value occurrence.

Br,
Ivan

3 Likes

This is perfect. Thanks!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.