Skip to main content

question 1)

I have attributes in a format that I would like to remove using the BulkAttributeRemover.

e.g attribute names are in the format of :

A_B_C_D

A_C_D_D_E

What is the regex code to remove any attribute name where the count of underscores "_" is greater than 2 ?

the example of _{2,} only works if the searched character is next to each other.

question 2)

If i have a csv list (so manually using attribute keeper / remover is tedious) of attributes that need to be kept e.g.

Att_ToKeep:

1) Name

2 Age

3) Color

how would i join it to a populated table to keep only the required attributes (as described above?

  1. What are desired attribute names do you want to change from "A_B_C_D" and "A_C_D_D_E"? "A_B_C" and "A_C_D"?
  2. Don't the AttributeRemover or the AttributeKeeper help you?


  1. What are desired attribute names do you want to change from "A_B_C_D" and "A_C_D_D_E"? "A_B_C" and "A_C_D"?
  2. Don't the AttributeRemover or the AttributeKeeper help you?

Hey @takashi

 

 

1) I'm using the BulkAttributeRemover so would be removing all that fit the criteria.

 

 

2) Yes AttributeRemover / Keeper do the trick manually... but I have a list of attributes to remove so am looking for a more efficient method.
  1. What are desired attribute names do you want to change from "A_B_C_D" and "A_C_D_D_E"? "A_B_C" and "A_C_D"?
  2. Don't the AttributeRemover or the AttributeKeeper help you?

1) Ah, I misunderstood that you are going to rename the attributes. OK. You need to remove them. This regex matches any string that contains three or more underscores.

 

_.*_.*_

1) Ah, I misunderstood that you are going to rename the attributes. OK. You need to remove them. This regex matches any string that contains three or more underscores.

 

_.*_.*_

 

thanks @takashi what would the symbol be for less than 3?
  1. What are desired attribute names do you want to change from "A_B_C_D" and "A_C_D_D_E"? "A_B_C" and "A_C_D"?
  2. Don't the AttributeRemover or the AttributeKeeper help you?

1) This regex matches any string that contains two or less underscores. You needed this?

 

^o^_]*_?d^_]*_?i^_]*$
2) I think you will have to write a script if you actually need to remove attributes based on an external table. However, if your final goal is to configure the destination schema dynamically, the Dynamic Workflow approach described in this article could be useful.

 

Dynamic Workflows: Destination Schema is Derived from a Lookup Table

Reply