Question

Is it possible to use Regex in attribute name?

  • 23 November 2022
  • 3 replies
  • 23 views

Hello,

Can I use regex patterns to filter records based on a field name pattern? Or use them in Field Type converter? 

For example: If a record has field names containing “cost” in them e.g. “Average Cost for two”, “Cost range”, “Parking Costs” etc. I want to send these records to a certain destination? 

Or if the field names including “cost” in them, use field type converter to convert the values to integer.

I did not find any specific information on this in Docs. Played around with a few patterns. But even if some passed validation, they failed in preview. 

 

-Dhanashri

 


3 replies

Userlevel 3
Badge

Hey Dhanashri,

 

The str:contains function should allow you to do this. Give it a shot. 

Userlevel 3
Badge +1

@Dhanashri_Bhate 

 

please try the condition in StreamSets collector.

 

${str:contains(record:value('/f1'),'Cost') || str:contains(record:value('/f1'),'cost')}

Userlevel 3
Badge +1

@Dhanashri_Bhate 

Kindly close the question if the solution helped you on resolving the issue.

 

Thanks & Regards

Bikram_

Reply