String Manipulation (Variable)

Hello!

I want to create a dynamic regex regexReplace($Column Name$,"[^0-9]","") using String Manipulation (Variable) node or any appropriate node, where the column name is controlled by a flow variable.

The objective is to keep only the numbers in a given column (which may contain letters and special characters as well) and anything apart from the numbers will be replaced with null/blank.

I tried using join(“regexReplace($”, $${SColumn Name}$$, “$”, “,”,"[^0-9]",""), however, its not working. Any suggestions would be really helpful.

image

Many Thanks!

1 Like

Hi @Omprakash_Jena
You could use regex matcher in string manipulation and search for

one

and then filter out the true values

res
br

2 Likes

Hi @Daniel_Weikert ,

Thanks for the suggestion. However its not working for me. Please note the column name is controlled by a flow variable. How can I use flow variables in regex is another help I need.

Many Thanks!

Hi @Omprakash_Jena , while your column name is controlled by variable, your string manipulation is for manipulating the data in the column, so you would not use a (Variable) node, but rather use a data node, passing the column name as variable.

I use column expression to use dynamic column name and manipulate the data.

This is what the workflow looks like:
image

This is what I have as input data, and I called the column “Input”:
image

I defined the column name as a variable called “Column Name”:
image

And any manipulation is done according to the column that the variable “Column Name” has.

Here is the result:
image

And here is the workflow: Dynamic column name.knwf (7.8 KB)

2 Likes

Thanks a lot @bruno29a . It worked :smiley:

1 Like

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