Op maandag 01-12-2008 om 13:38 uur [tijdzone +0200], schreef Graeme
Geldenhuys:
> Hi,
> 
> I'm using the following regular expression:   'foob.*r'
> Calling MatchString() against each of the items in the stringlist, I
> expected it to match 3 items. Instead it only matches the first item
> and fails all the rest.  Why???
> 
> 
> --------------[  source code ]-------------------
>   sl := TStringList.Create;
>   sl.Add('1st foobr Item');
>   sl.Add('2nd Item');
>   sl.Add('3rd Item');
>   sl.Add('4th foobaoeuaor Item');
>   sl.Add('5th foobar Item');
> 
>   r := TRegexEngine.Create('foob.*r');
>   x := 0;
>   y := 0;
>   for i := 0 to sl.Count-1 do
>   begin
>     if r.MatchString(sl.Strings[i], x, y) then

Because of the offset y you give it? Try to reset it to 0 within the
loop.

Joost

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to