blob: 21b3208091b34eeb7b465e5de005a1e9f8f00117 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
uses regexpr;
var
engine : tRegexprEngine;
source, dest : ansistring;
count : longint;
begin
if not GenerateRegExprEngine( 'foo', [], engine) then
begin
writeln( 'Failed to generate regex. engine.' );
halt(1)
end;
source := 'foo bur a';
count := RegExprReplaceAll(engine, source, '@', dest);
if (count<>1) or (dest<>'@ bur a') then
halt(1);
source := 'xfoo bur a';
count := RegExprReplaceAll(engine, source, '@', dest);
if (count<>1) or (dest<>'x@ bur a') then
halt(1);
source := 'foo bur a';
count := RegExprReplaceAll(engine, source, '@', dest);
if (count<>1) or (dest<>'@ bur a') then
halt(1);
DestroyRegExprEngine( engine );
writeln('ok');
end.
|