How to find text inside a file with Regular Expression

0

Good morning

I need to create a script to normalize some files of type DFM (Delphi form file) where I need to change the expression the CommandText text to SQL.Text and whatever it has after =

  object QrUsuario: TSQLDataSet
    CommandText = 
      'select USUARIO_ATIVO, USUARIO_NOME, fdsafdsa143 34112 USUARIO_SENHA from TABELA_US' +
      'UARIO'
    MaxBlobSize = -1
    Params = <>
    SQLConnection = DbDados
    Left = 451
    Top = 80
  end

The problem happens when you have a line break as in the example above. If you have the same line it worked when using the script:

(CommandText) += ('.+')

But the break is not found.

To delimit the text you have to start and end with ' Anyone have any suggestions?

I tried to use this expression too, but then it does not stop:

(CommandText) += \s*('[\s\r\n\w\+\'\"\#\!\@\$\%\&\*\(\)\_\-\=\[\]\{\}\?\;\:\.\,\\|\<\>\/]+')
    
asked by anonymous 04.01.2019 / 13:03

1 answer

0

The command that worked was this:

CommandText = ((\s*'.*'|\s+\+)*)

It resulted in the matchazoixo:

CommandText = 'select USUARIO_ATIVO, USUARIO_NOME, USUARIO_SENHA from TABELA_US' + 
              'UARIO'

With group 1 with the value:

  'select USUARIO_ATIVO, USUARIO_NOME, USUARIO_SENHA from TABELA_US' +
  'UARIO'
    
04.01.2019 / 18:59