More flexible options for RegexRouter to replace string

Hi, I want to get advice and suggest for replacing string of the topic.

Is it possible to giving some function or option such as drop / replace / join / etc?

Source String: server_name.db_name.table_name_suffix1
Expected String: prefix-tablename
“transforms.AddPrefix.function”=“drop $3, “_””

Or it would be good to provide another transform option.

“transforms”: “StringFunction”,
“transforms.StringFunction.function”=“drop $3, “_””
1 Like

A function isn’t possible. I remember seeing some library on Github that allowed running Javascript functions as part of a transform, if that’s what you really need, but you should be able to write a regex that captures something like \.([^_]+)_([^_]+)\. for .table_name. then combine on $1$2 to remove the underscore in the middle

1 Like

Thank you. By applying your suggestion, underscore in $3 also can be removed. :slight_smile:

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