AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Reg Expr

Ein Thema von mohfa · begonnen am 19. Sep 2008 · letzter Beitrag vom 1. Nov 2008
Antwort Antwort
Seite 1 von 2  1 2      
mohfa

Registriert seit: 11. Feb 2007
97 Beiträge
 
Delphi 7 Enterprise
 
#1

Reg Expr

  Alt 19. Sep 2008, 21:59
Hi every body :

I want to search for a Hex Value using a RegExpr.

Let me suppose i have : MyFile.exe that contains the following hex Value :
( 79797979797979795383EC44B823104000B9000000008A1880
C310881883C00183C10181F937D1000075EBA8F0F031F0A9
F0F0F0F07A0870B39E780873B1F173B0F171E9EF17F0F065
DBA8F00030F0ABB3B3B3B37908A8C5CA30F073B0F073B434
EFC0B34BB3D8F5F0F0F0D9FAF0F0F0A9C81731F0D95BA5 )


and in an other text file i store all my match patterns .
ok then let me suppose this match pattern ( stored in this text file ): 5383EC44B823104000B9000000008A1880????A8 this means search for all Hex Values from 53 to A8

that gives me the Result :

5383EC44B823104000B9000000008A1880
C310881883C00183C10181F937D1000075EBA8F0F031F0A9
F0F0F0F07A0870B39E780873B1F173B0F171E9EF17F0F065
DBA8F00030F0ABB3B3B3B37908A8


Is there any way to do it .

Thank you All
  Mit Zitat antworten Zitat
Benutzerbild von s.h.a.r.k
s.h.a.r.k

Registriert seit: 26. Mai 2004
3.159 Beiträge
 
#2

Re: Reg Expr

  Alt 19. Sep 2008, 22:07
am i stupid or is there no question?!
»Remember, the future maintainer is the person you should be writing code for, not the compiler.« (Nick Hodges)
  Mit Zitat antworten Zitat
Benutzerbild von Die Muhkuh
Die Muhkuh

Registriert seit: 21. Aug 2003
7.332 Beiträge
 
Delphi 2009 Professional
 
#3

Re: Reg Expr

  Alt 19. Sep 2008, 22:11
Hi,

you can do this task with Pos and Copy, too. You do not need a reg expr for that.
  Mit Zitat antworten Zitat
mohfa

Registriert seit: 11. Feb 2007
97 Beiträge
 
Delphi 7 Enterprise
 
#4

Re: Reg Expr

  Alt 19. Sep 2008, 22:11
Zitat von s.h.a.r.k:
am i stupid or is there no question?!
No Sir ur'not . Cause i've done some modification .

Sorry Again .
  Mit Zitat antworten Zitat
Benutzerbild von Die Muhkuh
Die Muhkuh

Registriert seit: 21. Aug 2003
7.332 Beiträge
 
Delphi 2009 Professional
 
#5

Re: Reg Expr

  Alt 19. Sep 2008, 22:12
Zitat von mohfa:
Sorry Again .
Happens from time to time
  Mit Zitat antworten Zitat
Benutzerbild von s.h.a.r.k
s.h.a.r.k

Registriert seit: 26. Mai 2004
3.159 Beiträge
 
#6

Re: Reg Expr

  Alt 19. Sep 2008, 22:17
Zitat von Die Muhkuh:
Zitat von mohfa:
Sorry Again .
Happens from time to time
oh yes, it's late, too
»Remember, the future maintainer is the person you should be writing code for, not the compiler.« (Nick Hodges)
  Mit Zitat antworten Zitat
omata

Registriert seit: 26. Aug 2004
Ort: Nebel auf Amrum
3.154 Beiträge
 
Delphi 7 Enterprise
 
#7

Re: Reg Expr

  Alt 19. Sep 2008, 23:32
Delphi-Quellcode:
procedure GetHexValues(Input:string; Values:TStrings);
var RegExpr:TRegExpr;
begin
  RegExpr:=TRegExpr.Create;
  try
    Values.Clear;
    RegExpr.Expression := '[^A-F0-9]*([A-F0-9]*)[^A-F0-9]*';
    if RegExpr.Exec(Input) then begin
      repeat
        Values.Append(RegExpr.Match[1]);
      until not RegExpr.ExecNext;
    end;
  finally
    RegExpr.free;
  end;
end;
RegExpr
  Mit Zitat antworten Zitat
Benutzerbild von Mackhack
Mackhack

Registriert seit: 29. Nov 2003
Ort: San Diego, CA/USA
1.446 Beiträge
 
Delphi 2006 Architect
 
#8

Re: Reg Expr

  Alt 19. Sep 2008, 23:52
Zitat von omata:
Delphi-Quellcode:
procedure GetHexValues(Input:string; Values:TStrings);
var RegExpr:TRegExpr;
begin
  RegExpr:=TRegExpr.Create;
  try
    Values.Clear;
    RegExpr.Expression := '[^A-F0-9]*([A-F0-9]*)[^A-F0-9]*';
    if RegExpr.Exec(Input) then begin
      repeat
        Values.Append(RegExpr.Match[1]);
      until not RegExpr.ExecNext;
    end;
  finally
    RegExpr.free;
  end;
end;
RegExpr
Omata is our RegExpr expert here. Helped me before, too! 8)
Um etwas Neues zu schaffen muss man seine Ohren vor den Nein-sagern verschliessen um seinen Geist öffnen zu können.
(George Lukas)
  Mit Zitat antworten Zitat
mohfa

Registriert seit: 11. Feb 2007
97 Beiträge
 
Delphi 7 Enterprise
 
#9

Re: Reg Expr

  Alt 20. Sep 2008, 22:29
Zitat von omata:
Delphi-Quellcode:
procedure GetHexValues(Input:string; Values:TStrings);
var RegExpr:TRegExpr;
begin
  RegExpr:=TRegExpr.Create;
  try
    Values.Clear;
    RegExpr.Expression := '[^A-F0-9]*([A-F0-9]*)[^A-F0-9]*';
    if RegExpr.Exec(Input) then begin
      repeat
        Values.Append(RegExpr.Match[1]);
      until not RegExpr.ExecNext;
    end;
  finally
    RegExpr.free;
  end;
end;
RegExpr
Thank you omata will this RegExp accept the : ???? expression
  Mit Zitat antworten Zitat
omata

Registriert seit: 26. Aug 2004
Ort: Nebel auf Amrum
3.154 Beiträge
 
Delphi 7 Enterprise
 
#10

Re: Reg Expr

  Alt 20. Sep 2008, 22:38
Zitat von mohfa:
... RegExp accept the : ???? expression
what do you mean with this?

greedy-mode? yes that will be work. another way is RegExpr.ModifierG. see the help-file for RegExpr-Component.
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 1 von 2  1 2      


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 16:43 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz