2

I've to face the following challenge which I would like to automatize using a Regular Expression tool:

I have to match this two mappings:

  1. GetSQLParameter("@switch", SqlDbType.TinyInt, 1), _ GetSQLParameter("@IDUtente", SqlDbType.Int), _

  2. sqlClient.AddParameterWithValue("switch", SqlDbType.TinyInt, user.IDUser); sqlClient.AddParameterWithValue("IDUtente", SqlDbType.Int, user.IDUser);

I would like to use 2 capturing group on the first code to get the name of the parameter and it's DB type.

Then I would like to analyze the second piece of code matching the name of the parameter and it's DB Type just to replace it.

Is there a tool for making this kind of matching?

I've asked a strongly related question on Stack Overflow: Which solution to parse a text with Regex and save to a Database the capturing group?

3

1 Answer 1

0

Pentaho Data Integration (PDI) (aka Kettle) can easily do this.

You will need to start a new transformation, start with one of the input steps to import your data, then use the Regex Evaluation scripting step to "Create fields for capture groups," and finally use the Table Output (or Insert / Update) step to write the data out to the database.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.