Solved

Is it possible to use Regex in attribute name?

  • 23 November 2022
  • 4 replies
  • 76 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

 

icon

Best answer by Bikram 2 December 2022, 06:59

View original

4 replies

Userlevel 3
Badge

Hey Dhanashri,

 

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

Userlevel 5
Badge +1

@Dhanashri_Bhate 

 

please try the condition in StreamSets collector.

 

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

Userlevel 5
Badge +1

@Dhanashri_Bhate 

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

 

Thanks & Regards

Bikram_

Hello @Bikram @dima thanks for your inputs.

Unfortunately I have run out of lab time, so could not try this out. Closing the question for now.  

 

Reply