Regex Regular Expression - Include parentheses instead of quotation marks

Asked

Viewed 167 times

1

How to exchange quotation marks for a tag? working to convert (*. dml ->Delphi form) where something that was like text becomes a list (stringlist).

Text Example:

CommandText = 'SELECT * FROM PRODUTOS'

We want to convert to

SQL.Text = ('SELECT * FROM PRODUTOS')

Note that we have to include the parentheses of Start ( and end ). Leaving the quotation marks.

How could this expression of Regex be elaborated NOTE: I will use to migrate Tsimpledataset

  • 2

    What language will you use to make this replacement?

  • You just want to replace the content of the command text by itself in quotes or you want to change the entire command text sequence =... For SQL.TEXT =...?

1 answer

0

I don’t know much about Delphi, but I took a peek. The regex seems to be simple if all its variables have that name (more examples were missing).
CommandText = '(.*)'
The command would be TRegEx.Replace(string, 'CommandText = ''(.*)'' ', 'SQL.Text = (''\1'')')
Example

Browser other questions tagged

You are not signed in. Login or sign up in order to post.