{Here it is : The very fast Knuth Morris Pratt algo. It is only implemented to search for a substring in a string but you can easily transform it to search into a whole text. Sorry but it's not well commented. I'm sure you'll understand ;-> } program kmp; uses crt; const longmaxchaine=50; longmaxchaineplus1=51; type chaine=string[longmaxchaine]; lmcplus1=1..longmaxchaineplus1; tablongueur=array[1..longmaxchaine] of integer; PROCEDURE compilation(tmodele:chaine; var longueur:tablongueur); var im,k,lm,toto:integer; fini:boolean; BEGIN lm:=length(tmodele); im:=1; k:=0; longueur[1]:=0; while imlm then trouve:=true else trouve:=false; if trouve then writeln('Trouve en ',is-im+1); end; {----------------------------- MAIN ----------------------------------------} var tsujet,tmodele:chaine; trouve:boolean; BEGIN clrscr; tsujet:='klfglkhooladfgdfhoolahrthhooli'; tmodele:='hoo'; writeln('sujet:"',tsujet,'"'); writeln('modele:"',tmodele,'"'); recherche(tsujet,length(tsujet),tmodele,trouve); if not trouve then writeln('Pas trouve'); readkey; end. {You can email me (Ludovic Russo).Here is my address: lrusso@ice.unice.fr}