Forum > General

regular Expression Help needed

(1/2) > >>

BSaidus:
Hello.
I have this .DMF file, and I wante to locate "Parameters = <> " under the TADOQuery to delete it.
so How I do that.
I have only the idea to use regex.

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---      object stbBottom: TStatusBar      Left = 3      Top = 431      Width = 766      Height = 19      Panels = <        item          Width = 150        end        item          Width = 50        end>      ParentShowHint = False      ShowHint = False    end  end  object pnlTopInfos: TPanel    Left = 0    Top = 0    Width = 772    Height = 153    Align = alTop    BorderStyle = bsSingle    TabOrder = 1    object ImgFond1: TImage      Left = 1      Top = 66      Width = 766      Height = 82      Hint = 'FOND1'      Align = alClient    end  object qryBEZZZListe: TADOQuery    Connection = DMConnect.cntMain    CursorType = ctStatic    Parameters = <>    SQL.Strings = ()    Left = 400    Top = 8    object qryBEZZZListeBEZZZ_CODE: TStringField      DisplayLabel = 'Equipe'      DisplayWidth = 12      FieldName = 'BEZZZ_CODE'      Size = 10    end 
I use regex from http://wiki.freepascal.org/Regexpr.

CCRDude:
What kind of help do you need exactly?

Do you want to remove any parameters, or just empty ones like in your quote? If the former, are you simply looking for the expression Parameters = \<[^\\>]*\> maybe?

BSaidus:
need to locate a block 

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---  object qryBEZZZListe: TADOQuery    Connection = DMConnect.cntMain    CursorType = ctStatic    Parameters = <>    SQL.Strings = ()    Left = 400    Top = 8    object qryBEZZZListeBEZZZ_CODE: TStringField      DisplayLabel = 'Equipe'      DisplayWidth = 12      FieldName = 'BEZZZ_CODE'      Size = 10    end 
then in the block I need to locate
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---Parameters = <> and delete it.

BUT the
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---Parameters = <> must ne in the block of TADOQuery because perhaps this property can exists for other components.


Thsnk

rvk:
Probably only the empty Parameters from object "TADOQuery".

So first step would be to match /: TADOQuery(.*)object/ (Parameters probably always exists for subcomponents)
Next would be to remove "Parameters = <> " from those matches.

Not sure if and how it should be done with one regex.

For help and testing there are some online regex sites.
https://regexr.com/
https://regex101.com/
https://www.regexpal.com/

Thaddy:
You do not need regexpr for that.
Just use the string.parse from sysutils on the Tstrings.text string....
No time now, but will add example later.(easy)

Navigation

[0] Message Index

[#] Next page

Go to full version