anchor.diff:     end;
     end;
    end;
  + function NewUnicodeChar(UnicodeChar:longword):PFLRENode;
  + var Index:longint;
  +     TemporaryString:ansistring;
  +     TemporaryNode:PFLRENode;
  + begin
  +  result:=nil;
  +  TemporaryString:=UTF32CharToUTF8(UnicodeChar);
  +  try
  +   for Index:=1 to length(TemporaryString) do begin
  +    TemporaryNode:=NewNode(ntCHAR,nil,nil,nil,0);
  +    TemporaryNode^.CharClass:=[TemporaryString[Index]];
  +    if assigned(result) then begin
  +     result:=Concat(result,TemporaryNode);
  +    end else begin
  +     result:=TemporaryNode;
  +    end;
  +   end;
  +  finally
  +   TemporaryString:='';
  +  end;
  + end;
  + function NewCharEx(UnicodeChar:longword):PFLRENode;
  + begin           
  +  if (rfUTF8 in Flags) and (UnicodeChar>=$80) then begin
  +   result:=NewUnicodeChar(UnicodeChar);
  +  end else if UnicodeChar<=$ff then begin
  +   result:=NewNode(ntCHAR,nil,nil,nil,0);
  +   result^.CharClass:=[ansichar(byte(UnicodeChar))];
  +  end else begin
  +   raise EFLRE.Create('Syntax error');
  +  end;
  + end;
  + function NewChar(UnicodeChar:longword):PFLRENode;
  + var LowerCaseUnicodeChar,UpperCaseUnicodeChar:longword;
  + begin
  +  LowerCaseUnicodeChar:=UnicodeToLower(UnicodeChar);
  +  UpperCaseUnicodeChar:=UnicodeToUpper(UnicodeChar);
  +  if (rfCASEINSENSITIVE in Flags) and (LowerCaseUnicodeChar<>UpperCaseUnicodeChar) then begin
  +   if (rfUTF8 in Flags) and ((LowerCaseUnicodeChar>=$80) or (UpperCaseUnicodeChar>=$80)) then begin
  +    result:=NewAlt(NewCharEx(LowerCaseUnicodeChar),NewCharEx(UpperCaseUnicodeChar));
  +   end else begin
  +    result:=NewNode(ntCHAR,nil,nil,nil,0);
  +    result^.CharClass:=[ansichar(byte(LowerCaseUnicodeChar)),ansichar(byte(UpperCaseUnicodeChar))];
  +   end;
  +  end else begin
  +   if (rfUTF8 in Flags) and (UnicodeChar>=$80) then begin
  +    result:=NewCharEx(UnicodeChar);
  +   end else begin
  +    result:=NewNode(ntCHAR,nil,nil,nil,0);
  +    result^.CharClass:=[ansichar(byte(UnicodeChar))];
  +   end;
  +  end;
  + end;
  + function CompileUTF8Range(Lo,Hi:longword):PFLRENode;
  + type TString6Chars=string[6];
  + const Seq0010ffff:array[0..6,0..4,0..1] of longint=((($00,$7f),(-1,-1),(-1,-1),(-1,-1),(-1,-1)),        // 00-7F
  +                                                     (($c2,$df),($80,$bf),(-1,-1),(-1,-1),(-1,-1)),      // C2-DF 80-BF
  +                                                     (($e0,$e0),($a0,$bf),($80,$bf),(-1,-1),(-1,-1)),    // E0-E0 A0-BF 80-BF
  +                                                     (($e1,$ef),($80,$bf),($80,$bf),(-1,-1),(-1,-1)),    // E1-EF 80-BF 80-BF
  +                                                     (($f0,$f0),($80,$bf),($80,$bf),($80,$bf),(-1,-1)),  // F0-F0 90-BF 80-BF 80-BF
  +                                                     (($f1,$f3),($80,$bf),($80,$bf),($80,$bf),(-1,-1)),  // F1-F3 80-BF 80-BF 80-BF
  +                                                     (($f4,$f4),($80,$bf),($80,$bf),($80,$bf),(-1,-1))); // F4-F4 80-8F 80-BF 80-BF
  +       HexChars:array[$0..$f] of ansichar='0123456789ABCDEF';
  + var OutputNode,NodeChain:PFLRENode;
  +  procedure Add(const NewNode:PFLRENode);
  +  begin
  +   if assigned(NewNode) then begin
  +    if assigned(NodeChain) then begin
  +     NodeChain:=Concat(OutputNode,NewNode);
  +    end else begin
  +     NodeChain:=NewNode;
  +    end;
  +   end;
  +  end;
  +  procedure AddSuffix;
  +  begin
  +   if assigned(NodeChain) then begin
  +    if assigned(OutputNode) then begin
  +     OutputNode:=NewAlt(OutputNode,NodeChain);
  +    end else begin
  +     OutputNode:=NodeChain;
  +    end;
  +    NodeChain:=nil;
  +   end;
  +  end;
  +  function ToString(CharValue:longword):TString6Chars;
  +  begin
  +   case CharValue of
  +    $00000000..$0000007f:begin
  +     SetLength(result,1);
  +     result[1]:=ansichar(byte(CharValue));
  +    end;
  +    $00000080..$000007ff:begin
  +     SetLength(result,2);
  +     result[1]:=ansichar(byte($c0 or ((CharValue shr 6) and $1f)));
  +     result[2]:=ansichar(byte($80 or (CharValue and $3f)));
  +    end;
  + // {$ifdef PLREStrictUTF8}$00000800..$0000d7ff,$0000e000..$0000ffff{$else}$00000800..$0000ffff{$endif}:begin
  +    $00000800..$0000ffff:begin
  +     SetLength(result,3);
  +     result[1]:=ansichar(byte($e0 or ((CharValue shr 12) and $0f)));
  +     result[2]:=ansichar(byte($80 or ((CharValue shr 6) and $3f)));
  +     result[3]:=ansichar(byte($80 or (CharValue and $3f)));
  +    end;
  +    $00010000..$0010ffff:begin
  +     SetLength(result,4);
  +     result[1]:=ansichar(byte($f0 or ((CharValue shr 18) and $07)));
  +     result[2]:=ansichar(byte($80 or ((CharValue shr 12) and $3f)));
  +     result[3]:=ansichar(byte($80 or ((CharValue shr 6) and $3f)));
  +     result[4]:=ansichar(byte($80 or (CharValue and $3f)));
  +    end;
  +    $00200000..$03ffffff:begin
  +     SetLength(result,5);
  +     result[1]:=ansichar(byte($f8 or ((CharValue shr 24) and $03)));
  +     result[2]:=ansichar(byte($80 or ((CharValue shr 18) and $3f)));
  +     result[3]:=ansichar(byte($80 or ((CharValue shr 12) and $3f)));
  +     result[4]:=ansichar(byte($80 or ((CharValue shr 6) and $3f)));
  +     result[5]:=ansichar(byte($80 or (CharValue and $3f)));
  +    end;
  +    $04000000..$7fffffff:begin
  +     SetLength(result,6);
  +     result[1]:=ansichar(byte($fc or ((CharValue shr 30) and $01)));
  +     result[2]:=ansichar(byte($80 or ((CharValue shr 24) and $3f)));
  +     result[3]:=ansichar(byte($80 or ((CharValue shr 18) and $3f)));
  +     result[4]:=ansichar(byte($80 or ((CharValue shr 12) and $3f)));
  +     result[5]:=ansichar(byte($80 or ((CharValue shr 6) and $3f)));
  +     result[6]:=ansichar(byte($80 or (CharValue and $3f)));
  +    end;
  +    else begin
  +     SetLength(result,3);
  +     result[1]:=#$ef;
  +     result[2]:=#$bf;
  +     result[3]:=#$bd;
  +    end;
  +   end;
  +  end;
  +  procedure AddRange(const Lo,Hi:byte);
  +  var Node:PFLRENode;
  +  begin
  +   Node:=NewNode(ntCHAR,nil,nil,nil,0);
  +   Node^.CharClass:=[ansichar(byte(Lo))..ansichar(byte(Hi))];
  +   Add(Node);
  +  end;
  +  procedure ProcessRange(Lo,Hi:longword);
  +  var i,m:longword;
  +      StrLo,StrHi:TString6Chars;
  +      CurrentNode:PFLRENode;
  +  begin
  +   if Hi>$0010ffff then begin
  +    Hi:=$0010ffff;
  +   end;
  +   if Lo<=Hi then begin
  +    if (Lo=$00000000) and (Hi=$0010ffff) then begin
  +     for m:=low(Seq0010ffff) to high(Seq0010ffff) do begin
  +      for i:=low(Seq0010ffff[m]) to high(Seq0010ffff[m]) do begin
  +       if Seq0010ffff[m,i,0]<0 then begin
  +        break;
  +       end;
  +       AddRange(byte(Seq0010ffff[m,i,0]),byte(Seq0010ffff[m,i,1]));
  +      end;
  +      AddSuffix;
  +     end;
  +    end else if (Lo=$00000080) and (Hi=$0010ffff) then begin
  +     for m:=1 to high(Seq0010ffff) do begin
  +      for i:=low(Seq0010ffff[m]) to high(Seq0010ffff[m]) do begin
  +       if Seq0010ffff[m,i,0]<0 then begin
  +        break;
  +       end;
  +       AddRange(byte(Seq0010ffff[m,i,0]),byte(Seq0010ffff[m,i,1]));
  +      end;
  +      AddSuffix;
  +     end;
  +    end else begin
  +     for i:=1 to 3 do begin
  +      if i=1 then begin
  +       m:=7;
  +      end else begin
  +       m:=(7-i)+(6*(i-1));
  +      end;
  +      m:=(1 shl m)-1;
  +      if (Lo<=m) and (m<Hi) then begin
  +       ProcessRange(Lo,m);
  +       ProcessRange(m+1,Hi);
  +       exit;
  +      end;
  +     end;
  +     if Hi<128 then begin
  +      AddRange(Lo,Hi);
  +      AddSuffix;
  +     end else begin
  +      for i:=1 to 3 do begin
  +       m:=(1 shl (6*i))-1;
  +       if (Lo and not m)<>(Hi and not m) then begin
  +        if (Lo and m)<>0 then begin
  +         ProcessRange(Lo,Lo or m);
  +         ProcessRange((Lo or m)+1,Hi);
  +         exit;
  +        end else if (Hi and m)<>m then begin
  +         ProcessRange(Lo,(Hi and not m)-1);
  +         ProcessRange(Hi and not m,Hi);
  +         exit;
  +        end;
  +       end;
  +      end;
  +      StrLo:=ToString(Lo);
  +      StrHi:=ToString(Hi);
  +      if length(StrLo)=length(StrHi) then begin
  +       for i:=1 to length(StrLo) do begin
  +        AddRange(byte(StrLo[i]),byte(StrHi[i]));
  +       end;
  +       AddSuffix;
  +      end;
  +     end;
  +    end;
  +   end;
  +  end;
  + begin
  +  OutputNode:=nil;
  +  NodeChain:=nil;
  +  ProcessRange(Lo,Hi);
  +  result:=OutputNode;
  + end;
  + function NewUnicodeCharClass(UnicodeCharClass:TFLREUnicodeCharClass):PFLRENode;
  + var Range:TFLREUnicodeCharClassRange;
  +     Node:PFLRENode;
  + begin
  +  UnicodeCharClass.Optimize;
  +  if UnicodeCharClass.IsSingle then begin
  +   result:=NewChar(UnicodeCharClass.First.Lo);
  +  end else begin
  +   if (rfUTF8 in Flags) and assigned(UnicodeCharClass.Last) and (UnicodeCharClass.Last.Hi>=128) then begin
  +    result:=nil;
  +    Range:=UnicodeCharClass.First;
  +    while assigned(Range) do begin
  +     if (Range.Lo<=$10ffff) and (Range.Lo=Range.Hi) then begin
  +      Node:=NewCharEx(Range.Lo);
  +     end else begin
  +      Node:=CompileUTF8Range(Range.Lo,Range.Hi);
  +     end;
  +     if assigned(result) then begin
  +      result:=NewAlt(result,Node);
  +     end else begin
  +      result:=Node;
  +     end;
  +     Range:=Range.Next;
  +    end;
  +   end else begin
  +    result:=NewNode(ntCHAR,nil,nil,nil,0);
  +    result^.CharClass:=[];
  +    Range:=UnicodeCharClass.First;
  +    while assigned(Range) and (Range.Lo<256) do begin
  +     if Range.Lo=Range.Hi then begin
  +      Include(result^.CharClass,ansichar(byte(Range.Lo)));
  +     end else begin
  +      if Range.Hi<256 then begin
  +       result^.CharClass:=result^.CharClass+[ansichar(byte(Range.Lo))..ansichar(byte(Range.Hi))];
  +      end else begin
  +       result^.CharClass:=result^.CharClass+[ansichar(byte(Range.Lo))..#$ff];
  +      end;
  +     end;
  +     Range:=Range.Next;
  +    end;
  +   end;
  +  end;
  + end;
  + function TestClassPOSIXCharacterClass:boolean;
  + var LocalSourcePosition,i:longint;
  + begin
  +  result:=false;
  +  LocalSourcePosition:=SourcePosition;
  +
  +  if (LocalSourcePosition<=SourceLength) and (Source[LocalSourcePosition]='[') then begin
  +   inc(LocalSourcePosition);
  +  end else begin
  +   exit;
  +  end;
  +
  +  if (LocalSourcePosition<=SourceLength) and (Source[LocalSourcePosition]=':') then begin
  +   inc(LocalSourcePosition);
  +  end else begin
  +   exit;
  +  end;
  +
  +  if (LocalSourcePosition<=SourceLength) and (Source[LocalSourcePosition]='^') then begin
  +   inc(LocalSourcePosition);
  +  end else begin
  +   exit;
  +  end;
  +
  +  i:=0;
  +  while (LocalSourcePosition<=SourceLength) and (Source[LocalSourcePosition] in ['a'..'z','A'..'Z','0'..'9','_','-']) do begin
  +   inc(LocalSourcePosition);
  +  end;
  +  if i=0 then begin
  +   exit;
  +  end;
  +
  +  if (LocalSourcePosition<=SourceLength) and (Source[LocalSourcePosition]=':') then begin
  +   inc(LocalSourcePosition);
  +  end else begin
  +   exit;
  +  end;
  +
  +  if (LocalSourcePosition<=SourceLength) and (Source[LocalSourcePosition]=']') then begin
  +   inc(LocalSourcePosition);
  +  end else begin
  +   exit;
  +  end;
  +
  +  result:=true;
  + end;
  + function ParseClassPOSIXCharacterClass(const UnicodeCharClass:TFLREUnicodeCharClass;const CanBeAlreadyCanonicalized:boolean):boolean;
  + var Name:ansistring;
  +     Negate,IgnoreCase:boolean;
  + begin
  +  result:=false;
  +
  +  IgnoreCase:=CanBeAlreadyCanonicalized and (rfCASEINSENSITIVE in Flags);
  +
  +  if (SourcePosition<=SourceLength) and (Source[SourcePosition]='[') then begin
  +   inc(SourcePosition);
  +  end else begin
  +   raise EFLRE.Create('Syntax error');
  +  end;
  +
  +  if (SourcePosition<=SourceLength) and (Source[SourcePosition]=':') then begin
  +   inc(SourcePosition);
  +  end else begin
  +   raise EFLRE.Create('Syntax error');
  +  end;
  +
  +  if (SourcePosition<=SourceLength) and (Source[SourcePosition]='^') then begin
  +   inc(SourcePosition);
  +   Negate:=true;
  +  end else begin
  +   Negate:=false;
  +  end;
  +
  +  Name:='';
  +  while (SourcePosition<=SourceLength) and (Source[SourcePosition] in ['a'..'z','A'..'Z','0'..'9','_','-']) do begin
  +   Name:=Name+Source[SourcePosition];
  +   inc(SourcePosition);
  +  end;
  +
  +  if (SourcePosition<=SourceLength) and (Source[SourcePosition]=':') then begin
  +   inc(SourcePosition);
  +  end else begin
  +   raise EFLRE.Create('Syntax error');
  +  end;
  +
  +  if (SourcePosition<=SourceLength) and (Source[SourcePosition]=']') then begin
  +   inc(SourcePosition);
  +  end else begin
  +   raise EFLRE.Create('Syntax error');
  +  end;
  +
  +  GetCharClassPerName(Name,UnicodeCharClass,IgnoreCase);
  +  if Negate then begin
  +   UnicodeCharClass.Invert;
  +   UnicodeCharClass.Inverted:=false;
  +  end;
  +
  +  result:=true;
  + end;
  + function ParseClassEscapeUnicodeProperty(const UnicodeCharClass:TFLREUnicodeCharClass;const CanBeAlreadyCanonicalized:boolean):boolean;
  + var Identifier:ansistring;
  +     i:longword;
  +     IgnoreCase,IsNegative:boolean;
  +     f,LastSourcePos,UntilSourcePos:longint;
  + begin
  +  result:=false;
  +  if SourcePosition<=SourceLength then begin
  +   IgnoreCase:=CanBeAlreadyCanonicalized and (rfCASEINSENSITIVE in Flags);
  +   case Source[SourcePosition] of
  +    'a'..'z','A'..'Z':begin
  +     f:=UnicodeClassHashMap.GetValue(UTF32CharToUTF8(UnicodeToLower(byte(ansichar(Source[SourcePosition])))));
  +     if f>=0 then begin
  +      inc(SourcePosition);
  +      UnicodeCharClass.AddUnicodeCategory(f,IgnoreCase);
  +      result:=true;
  +     end;
  +    end;
  +    '{':begin
  +     LastSourcePos:=SourcePosition;
  +     inc(SourcePosition);
  +     if (SourcePosition<=SourceLength) and (Source[SourcePosition]='^') then begin
  +      LastSourcePos:=SourcePosition;
  +      inc(SourcePosition);
  +      IsNegative:=true;
  +      IgnoreCase:=false;
  +     end else begin
  +      IsNegative:=false;
  +     end;
  +     UntilSourcePos:=LastSourcePos;
  +     while (SourcePosition<=SourceLength) and (Source[SourcePosition] in ['a'..'z','A'..'Z','0'..'9','_','-']) do begin
  +      UntilSourcePos:=SourcePosition;
  +      inc(SourcePosition);
  +     end;
  +     if (LastSourcePos<UntilSourcePos) and ((SourcePosition<=SourceLength) and (Source[SourcePosition]='}')) then begin
  +      Identifier:=UTF8LowerCase(copy(Source,LastSourcePos,UntilSourcePos-LastSourcePos));
  +      inc(SourcePosition);
  +      GetCharClassPerName(Identifier,UnicodeCharClass,IgnoreCase);
  +      if IsNegative and assigned(UnicodeCharClass.First) then begin
  +       UnicodeCharClass.Invert;
  +       UnicodeCharClass.Inverted:=false;
  +       if CanBeAlreadyCanonicalized and (rfCASEINSENSITIVE in Flags) then begin
  +        UnicodeCharClass.Canonicalize;
  +       end;
  +      end;
  +      result:=true;
  +     end;
  +    end;
  +   end;
  +  end;
  + end;
  + function ParseClassEscape(const CanBeAlreadyCanonicalized:boolean):TFLREUnicodeCharClass;
  + var i:longint;
  +     IgnoreCase:boolean;
  +     UnicodeChar:longword;
  + begin
  +  result:=nil;
  +  try
  +   IgnoreCase:=CanBeAlreadyCanonicalized and (rfCASEINSENSITIVE in Flags);
  +   result:=TFLREUnicodeCharClass.Create(self);
  +   if (SourcePosition<=SourceLength) and (Source[SourcePosition] in ['0'..'9']) then begin
  +    i:=0;
  +    while (SourcePosition<=SourceLength) and (Source[SourcePosition] in ['0'..'9']) do begin
  +     i:=(i*10)+longint(byte(ansichar(Source[SourcePosition]))-byte(ansichar('0')));
  +     inc(SourcePosition);
  +    end;
  +    if i<>0 then begin
  +     raise EFLRE.Create('Syntax error');
  +    end;
  +    result.AddChar(i,IgnoreCase);
  +    result.Canonicalized:=IgnoreCase;
  +    exit;
  +   end;
  +   case Source[SourcePosition] of
  +    'a':begin
  +     inc(SourcePosition);
  +     result.AddChar($0007,IgnoreCase);
  +     result.Canonicalized:=true;
  +    end;
  +    'b':begin
  +     inc(SourcePosition);
  +     result.AddChar($0008,IgnoreCase);
  +     result.Canonicalized:=true;
  +    end;
  +    'B':begin
  +     inc(SourcePosition);
  +     result.AddChar(ord('\'),IgnoreCase);
  +     result.Canonicalized:=true;
  +    end;
  +    't':begin
  +     inc(SourcePosition);
  +     result.AddChar(9,IgnoreCase);
  +     result.Canonicalized:=true;
  +    end;
  +    'n':begin
  +     inc(SourcePosition);
  +     result.AddChar(10,IgnoreCase);
  +     result.Canonicalized:=true;
  +    end;
  +    'v':begin
  +     inc(SourcePosition);
  +     result.AddChar(11,IgnoreCase);
  +     result.Canonicalized:=true;
  +    end;
  +    'f':begin
  +     inc(SourcePosition);
  +     result.AddChar(12,IgnoreCase);
  +     result.Canonicalized:=true;
  +    end;
  +    'r':begin
  +     inc(SourcePosition);
  +     result.AddChar(13,IgnoreCase);
  +     result.Canonicalized:=true;
  +    end;
  +    'e':begin
  +     inc(SourcePosition);
  +     result.AddChar($1b,IgnoreCase);
  +     result.Canonicalized:=true;
  +    end;
  +    'w','W':begin
  +     if rfUTF8 in Flags then begin
  +      for i:=0 to length(UnicodeCharRangeClasses[ucrWORDS])-1 do begin
  +       result.AddRange(UnicodeCharRangeClasses[ucrWORDS,i,0],UnicodeCharRangeClasses[ucrWORDS,i,1],IgnoreCase);
  +      end;
  +     end else begin
  +      result.AddRange(ord('a'),ord('z'),IgnoreCase);
  +      result.AddRange(ord('A'),ord('Z'),IgnoreCase);
  +      result.AddRange(ord('0'),ord('9'),IgnoreCase);
  +      result.AddChar(ord('_'),IgnoreCase);
  +     end;
  +     if Source[SourcePosition]='W' then begin
  +      result.Invert;
  +      result.Inverted:=false;
  +     end;
  +     result.Canonicalized:=true;
  +     inc(SourcePosition);
  +    end;
  +    's','S':begin
  +     if rfUTF8 in Flags then begin
  +      for i:=0 to length(UnicodeCharRangeClasses[ucrWHITESPACES])-1 do begin
  +       result.AddRange(UnicodeCharRangeClasses[ucrWHITESPACES,i,0],UnicodeCharRangeClasses[ucrWHITESPACES,i,1],IgnoreCase);
  +      end;
  +     end else begin
  +      result.AddRange(9,13,IgnoreCase);
  +      result.AddChar(32,IgnoreCase);
  +     end;
  +     if Source[SourcePosition]='S' then begin
  +      result.Invert;
  +      result.Inverted:=false;
  +     end;
  +     result.Canonicalized:=true;
  +     inc(SourcePosition);
  +    end;
  +    'd','D':begin
  +     if rfUTF8 in Flags then begin
  +      for i:=0 to length(UnicodeCharRangeClasses[ucrDIGITS])-1 do begin
  +       result.AddRange(UnicodeCharRangeClasses[ucrDIGITS,i,0],UnicodeCharRangeClasses[ucrDIGITS,i,1],IgnoreCase);
  +      end;
  +     end else begin
  +      result.AddRange(ord('0'),ord('9'),IgnoreCase);
  +     end;
  +     if Source[SourcePosition]='D' then begin
  +      result.Invert;
  +      result.Inverted:=false;
  +     end;
  +     result.Canonicalized:=true;
  +     inc(SourcePosition);
  +    end;
  +    'p':begin
  +     inc(SourcePosition);
  +     if ParseClassEscapeUnicodeProperty(result,CanBeAlreadyCanonicalized) then begin
  +      result.Canonicalized:=true;
  +     end else begin
  +      raise EFLRE.Create('Syntax error');
  +     end;
  +    end;
  +    'P':begin
  +     inc(SourcePosition);
  +     if ParseClassEscapeUnicodeProperty(result,CanBeAlreadyCanonicalized) then begin
  +      result.Canonicalized:=true;
  +     end else begin
  +      raise EFLRE.Create('Syntax error');
  +     end;
  +     result.Invert;
  +     result.Inverted:=false;
  +     result.Canonicalized:=true;
  +    end;
  +    'c':begin
  +     inc(SourcePosition);
  +     if (SourcePosition<=SourceLength) and (Source[SourcePosition] in ['a'..'z','A'..'Z']) then begin
  +      case Source[SourcePosition] of
  +       'a'..'z':begin
  +        result.AddChar(byte(ansichar(Source[SourcePosition]))-byte(ansichar('a')),IgnoreCase);
  +       end;
  +       'A'..'Z':begin
  +        result.AddChar(byte(ansichar(Source[SourcePosition]))-byte(ansichar('A')),IgnoreCase);
  +       end;
  +      end;
  +      result.Canonicalized:=IgnoreCase;
  +     end else begin
  +      raise EFLRE.Create('Syntax error');
  +     end;
  +    end;
  +    'x':begin
  +     inc(SourcePosition);
  +     if ((SourcePosition+1)<=SourceLength) and
  +        (Source[SourcePosition+0] in ['0'..'9','a'..'f','A'..'F']) and
  +        (Source[SourcePosition+1] in ['0'..'9','a'..'f','A'..'F']) then begin
  +      result.AddChar((Hex2Value(Source[SourcePosition+0]) shl 8) or Hex2Value(Source[SourcePosition+1]),IgnoreCase);
  +      inc(SourcePosition,2);
  +     end else if (SourcePosition<=SourceLength) and (Source[SourcePosition]='{') then begin
  +      inc(SourcePosition);
  +      UnicodeChar:=0;
  +      while (SourcePosition<=SourceLength) and (Source[SourcePosition] in ['0'..'9','a'..'f','A'..'F']) do begin
  +       UnicodeChar:=(UnicodeChar shl 4) or Hex2Value(Source[SourcePosition]);
  +       inc(SourcePosition);
  +      end;
  +      if (SourcePosition<=SourceLength) and (Source[SourcePosition]='}') then begin
  +       inc(SourcePosition);
  +       result.AddChar(UnicodeChar,IgnoreCase);
  +      end else begin
  +       raise EFLRE.Create('Syntax error');
  +      end;
  +     end else begin
  +      raise EFLRE.Create('Syntax error');
  +     end;
  +    end;
  +    'u':begin
  +     inc(SourcePosition);
  +     if ((SourcePosition+3)<=SourceLength) and
  +        (Source[SourcePosition+0] in ['0'..'9','a'..'f','A'..'F']) and
  +        (Source[SourcePosition+1] in ['0'..'9','a'..'f','A'..'F']) and
  +        (Source[SourcePosition+2] in ['0'..'9','a'..'f','A'..'F']) and
  +        (Source[SourcePosition+3] in ['0'..'9','a'..'f','A'..'F']) then begin
  +      UnicodeChar:=(Hex2Value(Source[SourcePosition+0]) shl 24) or (Hex2Value(Source[SourcePosition+1]) shl 16) or (Hex2Value(Source[SourcePosition+2]) shl 8) or Hex2Value(Source[SourcePosition+3]);
  +      inc(SourcePosition,4);
  +      result.AddChar(UnicodeChar,IgnoreCase);
  +     end else begin
  +      raise EFLRE.Create('Syntax error');
  +     end;
  +    end;
  +    'U':begin
  +     inc(SourcePosition);
  +     if (SourcePosition<=SourceLength) and (Source[SourcePosition] in ['0'..'9','a'..'f','A'..'F']) then begin
  +      UnicodeChar:=0;
  +      while (SourcePosition<=SourceLength) and (Source[SourcePosition] in ['0'..'9','a'..'f','A'..'F']) do begin
  +       UnicodeChar:=(UnicodeChar shl 4) or Hex2Value(Source[SourcePosition]);
  +       inc(SourcePosition);
  +      end;
  +      result.AddChar(UnicodeChar,IgnoreCase);
  +     end else begin
  +      raise EFLRE.Create('Syntax error');
  +     end;
  +    end;
  +    'Q':begin
  +     inc(SourcePosition);
  +     while SourcePosition<=SourceLength do begin
  +      if Source[SourcePosition]='\' then begin
  +       inc(SourcePosition);
  +       if (SourcePosition<=SourceLength) and (Source[SourcePosition]='E') then begin
  +        inc(SourcePosition);
  +        break;
  +       end else begin
  +        result.AddChar(ord('\'),IgnoreCase);
  +       end;
  +      end else begin
  +       if (rfUTF8 in Flags) and (byte(ansichar(Source[SourcePosition]))>=$80) then begin
  +        UnicodeChar:=UTF8CodeUnitGetCharAndIncFallback(Source,SourcePosition);
  +        result.AddChar(UnicodeChar,IgnoreCase);
  +       end else begin
  +        result.AddChar(byte(ansichar(Source[SourcePosition])),IgnoreCase);
  +        inc(SourcePosition);
  +       end;
  +      end;
  +     end;
  +     result.Canonicalized:=IgnoreCase;
  +    end;
  +    else begin
  +     if (rfUTF8 in Flags) and (byte(ansichar(Source[SourcePosition]))>=$80) then begin
  +      UnicodeChar:=UTF8CodeUnitGetCharAndIncFallback(Source,SourcePosition);
  +      result.AddChar(UnicodeChar,IgnoreCase);
  +     end else begin
  +      result.AddChar(byte(ansichar(Source[SourcePosition])),IgnoreCase);
  +      inc(SourcePosition);
  +     end;
  +    end;
  +   end;
  +  except
  +   FreeAndNil(result);
  +   raise;
  +  end;
  + end;
  + function ParseClassAtom:TFLREUnicodeCharClass;
  + begin
  +  result:=nil;
  +  try
  +   if SourcePosition<=SourceLength then begin
  +    if Source[SourcePosition]='\' then begin
  +     inc(SourcePosition);
  +     result:=ParseClassEscape(false);
  +    end else if TestClassPOSIXCharacterClass then begin
  +     result:=TFLREUnicodeCharClass.Create(self);
  +     if not ParseClassPOSIXCharacterClass(result,false) then begin
  +      raise EFLRE.Create('Syntax error');
  +     end;
  +    end else begin
  +     result:=TFLREUnicodeCharClass.Create(self);
  +     if (rfUTF8 in Flags) and (byte(ansichar(Source[SourcePosition]))>=$80) then begin
  +      result.AddChar(UTF8CodeUnitGetCharAndIncFallback(Source,SourcePosition));
  +     end else begin
  +      result.AddChar(byte(ansichar(Source[SourcePosition])));
  +      inc(SourcePosition);
  +     end;
  +    end;
  +   end else begin
  +    raise EFLRE.Create('Syntax error');
  +   end;
  +  except
  +   FreeAndNil(result);
  +   raise;
  +  end;
  + end;
  + function ParseCharacterClass:TFLREUnicodeCharClass;
  + var InvertFlag:boolean;
  +     a,b,c:TFLREUnicodeCharClass;
  + begin
  +  result:=nil;
  +  try
  +   a:=nil;
  +   b:=nil;
  +   try
  +    result:=TFLREUnicodeCharClass.Create(self);
  +    if (SourcePosition<=SourceLength) and (Source[SourcePosition]='[') then begin
  +     inc(SourcePosition);
  +    end else begin
  +     raise EFLRE.Create('Syntax error');
  +    end;
  +    if (SourcePosition<=SourceLength) and (Source[SourcePosition]='^') then begin
  +     inc(SourcePosition);
  +     InvertFlag:=true;
  +    end else begin
  +     InvertFlag:=false;
  +    end;
  +    while (SourcePosition<=SourceLength) and (Source[SourcePosition]<>']') do begin
  +     if ((SourcePosition+1)<=SourceLength) and ((Source[SourcePosition]='-') and (Source[SourcePosition+1] in ['[',']'])) then begin
  +      inc(SourcePosition);
  +      if Source[SourcePosition]=']' then begin
  +       a:=TFLREUnicodeCharClass.Create(self);
  +       a.AddChar(ord('-'));
  +      end else begin
  +       a:=ParseCharacterClass;
  +       b:=TFLREUnicodeCharClass.Create(self);
  +       if b.Subtraction(result,a) then begin
  +        FreeAndNil(result);
  +        result:=b;
  +        b:=nil;
  +       end else begin
  +        FreeAndNil(b);
  +       end;
  +       FreeAndNil(a);
  +       if not ((SourcePosition<=SourceLength) and (Source[SourcePosition]=']')) then begin
  +        raise EFLRE.Create('Syntax error');
  +       end;
  +       continue;
  +      end;
  +     end else begin
  +      a:=ParseClassAtom;
  +     end;
  +     if ((SourcePosition+1)<=SourceLength) and ((Source[SourcePosition]='&') and (Source[SourcePosition+1]='&')) then begin
  +      inc(SourcePosition,2);
  +      if (SourcePosition<=SourceLength) and (Source[SourcePosition] in ['[',']']) then begin
  +       if Source[SourcePosition]='[' then begin
  +        if assigned(a) then begin
  +         result.TakeoverCombine(a);
  +         FreeAndNil(a);
  +        end;
  +        a:=ParseCharacterClass;
  +        b:=TFLREUnicodeCharClass.Create(self);
  +        if b.Intersection(result,a) then begin
  +         FreeAndNil(result);
  +         result:=b;
  +         b:=nil;
  +        end else begin
  +         FreeAndNil(b);
  +        end;
  +        FreeAndNil(a);
  +        if not ((SourcePosition<=SourceLength) and (Source[SourcePosition]=']')) then begin
  +         raise EFLRE.Create('Syntax error');
  +        end;
  +        continue;
  +       end else begin
  +        raise EFLRE.Create('Syntax error');
  +       end;
  +      end else begin
  +       raise EFLRE.Create('Syntax error');
  +      end;
  +     end else if (SourcePosition<=SourceLength) and (Source[SourcePosition]='-') then begin
  +      inc(SourcePosition);
  +      if (SourcePosition<=SourceLength) and (Source[SourcePosition] in ['[',']']) then begin
  +       if Source[SourcePosition]='[' then begin
  +        if assigned(a) then begin
  +         result.TakeoverCombine(a);
  +         FreeAndNil(a);
  +        end;
  +        a:=ParseCharacterClass;
  +        b:=TFLREUnicodeCharClass.Create(self);
  +        if b.Subtraction(result,a) then begin
  +         FreeAndNil(result);
  +         result:=b;
  +         b:=nil;
  +        end else begin
  +         FreeAndNil(b);
  +        end;
  +        FreeAndNil(a);
  +        if not ((SourcePosition<=SourceLength) and (Source[SourcePosition]=']')) then begin
  +         raise EFLRE.Create('Syntax error');
  +        end;
  +        continue;
  +       end else begin
  +        a.AddChar(ord('-'));
  +       end;
  +      end else if assigned(a) then begin
  +       if not a.IsSingle then begin
  +        if assigned(a.Last) and (a.Last.Lo<=a.Last.Hi) then begin
  +         c:=TFLREUnicodeCharClass.Create(self);
  +         c.AddChar(a.Last.Hi);
  +         c.Canonicalized:=a.Canonicalized;
  +         c.Inverted:=a.Inverted;
  +         result.TakeoverCombine(a);
  +         FreeAndNil(a);
  +         a:=c;
  +        end else begin
  +         FreeAndNil(a);
  +         raise EFLRE.Create('Syntax error');
  +        end;
  +       end;
  +       b:=ParseClassAtom;
  +       if (not b.IsSingle) and (assigned(b.First) and (a.First.Lo<=a.First.Hi)) then begin
  +        c:=TFLREUnicodeCharClass.Create(self);
  +        c.AddChar(b.First.Lo);
  +        c.Canonicalized:=b.Canonicalized;
  +        c.Inverted:=b.Inverted;
  +        result.TakeoverCombine(b);
  +        FreeAndNil(b);
  +        b:=c;
  +       end;
  +       if (not b.IsSingle) or ((assigned(a.Last) and assigned(b.Last)) and not (a.Last.Lo<=b.Last.Hi)) then begin
  +        FreeAndNil(a);
  +        FreeAndNil(b);
  +        raise EFLRE.Create('Syntax error');
  +       end;
  +       if assigned(a.Last) and assigned(b.Last) then begin
  +        a.Last.Hi:=b.Last.Hi;
  +       end else begin
  +        a.TakeoverCombine(b);
  +       end;
  +       FreeAndNil(b);
  +      end;
  +     end;
  +     if assigned(a) then begin
  +      result.TakeoverCombine(a);
  +      FreeAndNil(a);
  +     end;
  +    end;
  +    if (SourcePosition<=SourceLength) and (Source[SourcePosition]=']') then begin
  +     inc(SourcePosition);
  +    end else begin
  +     raise EFLRE.Create('Syntax error');
  +    end;
  +    if (rfCASEINSENSITIVE in Flags) and not result.Canonicalized then begin
  +     result.Canonicalize;
  +    end;
  +    if InvertFlag then begin
  +     result.Invert;
  +    end;
  +   finally
  +    FreeAndNil(a);
  +    FreeAndNil(b);
  +   end;
  +  except
  +   FreeAndNil(result);
  +   raise;
  +  end;
  + end;
    function ParseAtom:PFLRENode;
    var Value,Index:longint;
        Negate,IsSingle,Done,IsNegative,First,Num:boolean;
  -     StartChar,EndChar:ansichar;
  -     CharClass:TFLRECharClass;
  +     StartChar,EndChar,UnicodeChar,LowerCaseUnicodeChar,UpperCaseUnicodeChar:longword;
  +     UnicodeCharClass:TFLREUnicodeCharClass;
        OldFlags:TFLREFlags;
  -     Name,TemporaryString:ansistring;
  -     UnicodeChar,LowerCaseUnicodeChar,UpperCaseUnicodeChar:longword;
  -     TemporaryNodes:array[0..3] of PFLRENode;
  +     Name:ansistring;
    begin
     result:=nil;
     try
  
positive.code:   end else if (NodeLeft^.NodeType=ntCHAR) and (NodeRight^.NodeType=ntCHAR) then begin
     result:=NewNode(ntCHAR,nil,nil,nil,0);
     result^.CharClass:=NodeLeft^.CharClass+NodeRight^.CharClass;
  // result:=ConvertUTF8CharClassNode(NewNode(ntCHAR,nil,nil,nil,RegExp.AddCharClass(c)));
    end else begin
     result:=NewNode(ntALT,NodeLeft,NodeRight,nil,0);
    end;
  
negative.code:   end;
   end;
   function ParseDisjunction:PFLRENode; forward;
   procedure GetCharClass(const CurrentChar:ansichar;const UnicodeCharClass:TFLREUnicodeCharClass;const IgnoreCase:boolean);
   var i:longint;
   begin
    case CurrentChar of
     '0':begin
      UnicodeCharClass.AddChar(0,IgnoreCase);
      UnicodeCharClass.Canonicalized:=true;
     end;
     't':begin
      UnicodeCharClass.AddChar(9,IgnoreCase);
      UnicodeCharClass.Canonicalized:=true;
     end;
     'n':begin
      UnicodeCharClass.AddChar(10,IgnoreCase);
      UnicodeCharClass.Canonicalized:=true;
     end;
     'v':begin
      UnicodeCharClass.AddChar(11,IgnoreCase);
      UnicodeCharClass.Canonicalized:=true;
     end;
     'f':begin
      UnicodeCharClass.AddChar(12,IgnoreCase);
      UnicodeCharClass.Canonicalized:=true;
     end;
     'r':begin
      UnicodeCharClass.AddChar(13,IgnoreCase);
      UnicodeCharClass.Canonicalized:=true;
     end;
     'e':begin
      UnicodeCharClass.AddChar($1b,IgnoreCase);
      UnicodeCharClass.Canonicalized:=true;
     end;
     'a','A':begin
      if rfUTF8 in Flags then begin
       UnicodeCharClass.AddUnicodeCategory((1 shl FLREUnicodeCategoryLu) or (1 shl FLREUnicodeCategoryLl) or (1 shl FLREUnicodeCategoryLt),IgnoreCase);
      end else begin
       UnicodeCharClass.AddRange(ord('a'),ord('z'),IgnoreCase);
       UnicodeCharClass.AddRange(ord('A'),ord('Z'),IgnoreCase);
      end;
      if CurrentChar='A' then begin
       UnicodeCharClass.Invert;
       UnicodeCharClass.Inverted:=false;
      end;
      UnicodeCharClass.Canonicalized:=true;
     end;
     'w','W':begin
      if rfUTF8 in Flags then begin
       for i:=0 to length(UnicodeCharRangeClasses[ucrWORDS])-1 do begin
        UnicodeCharClass.AddRange(UnicodeCharRangeClasses[ucrWORDS,i,0],UnicodeCharRangeClasses[ucrWORDS,i,1],IgnoreCase);
       end;
      end else begin
       UnicodeCharClass.AddRange(ord('a'),ord('z'),IgnoreCase);
       UnicodeCharClass.AddRange(ord('A'),ord('Z'),IgnoreCase);
       UnicodeCharClass.AddRange(ord('0'),ord('9'),IgnoreCase);
       UnicodeCharClass.AddChar(ord('_'),IgnoreCase);
      end;
      if CurrentChar='W' then begin
       UnicodeCharClass.Invert;
       UnicodeCharClass.Inverted:=false;
      end;
      UnicodeCharClass.Canonicalized:=true;
     end;
     's','S':begin
      if rfUTF8 in Flags then begin
       for i:=0 to length(UnicodeCharRangeClasses[ucrWHITESPACES])-1 do begin
        UnicodeCharClass.AddRange(UnicodeCharRangeClasses[ucrWHITESPACES,i,0],UnicodeCharRangeClasses[ucrWHITESPACES,i,1],IgnoreCase);
       end;
      end else begin
       UnicodeCharClass.AddRange(9,13,IgnoreCase);
       UnicodeCharClass.AddChar(32,IgnoreCase);
      end;
      if CurrentChar='S' then begin
       UnicodeCharClass.Invert;
       UnicodeCharClass.Inverted:=false;
      end;
      UnicodeCharClass.Canonicalized:=true;
     end;
     'd','D':begin
      if rfUTF8 in Flags then begin
       for i:=0 to length(UnicodeCharRangeClasses[ucrDIGITS])-1 do begin
        UnicodeCharClass.AddRange(UnicodeCharRangeClasses[ucrDIGITS,i,0],UnicodeCharRangeClasses[ucrDIGITS,i,1],IgnoreCase);
       end;
      end else begin
       UnicodeCharClass.AddRange(ord('0'),ord('9'),IgnoreCase);
      end;
      if CurrentChar='D' then begin
       UnicodeCharClass.Invert;
       UnicodeCharClass.Inverted:=false;
      end;
      UnicodeCharClass.Canonicalized:=true;
     end;
     'h','H':begin
      UnicodeCharClass.AddRange(ord('a'),ord('f'),IgnoreCase);
      UnicodeCharClass.AddRange(ord('A'),ord('f'),IgnoreCase);
      UnicodeCharClass.AddRange(ord('0'),ord('9'),IgnoreCase);
      if CurrentChar='H' then begin
       UnicodeCharClass.Invert;
       UnicodeCharClass.Inverted:=false;
      end;
      UnicodeCharClass.Canonicalized:=true;
     end;
     'c','C':begin
      if rfUTF8 in Flags then begin
       UnicodeCharClass.AddUnicodeCategory(1 shl FLREUnicodeCategoryCc,IgnoreCase);
      end else begin
       UnicodeCharClass.AddRange(0,31,IgnoreCase);
       UnicodeCharClass.AddChar(127,IgnoreCase);
      end;
      if CurrentChar='C' then begin
       UnicodeCharClass.Invert;
       UnicodeCharClass.Inverted:=false;
      end;
      UnicodeCharClass.Canonicalized:=true;
     end;
     'p','P':begin
      if rfUTF8 in Flags then begin
       UnicodeCharClass.AddUnicodeCategory((1 shl FLREUnicodeCategoryPd) or (1 shl FLREUnicodeCategoryPs) or (1 shl FLREUnicodeCategoryPe) or (1 shl FLREUnicodeCategoryPc) or (1 shl FLREUnicodeCategoryPo),IgnoreCase);
      end else begin
       UnicodeCharClass.AddChar(ord('!'),IgnoreCase);
       UnicodeCharClass.AddChar(ord('"'),IgnoreCase);
       UnicodeCharClass.AddChar(ord('#'),IgnoreCase);
       UnicodeCharClass.AddChar(ord('$'),IgnoreCase);
       UnicodeCharClass.AddChar(ord('%'),IgnoreCase);
       UnicodeCharClass.AddChar(ord('&'),IgnoreCase);
       UnicodeCharClass.AddChar(ord(''''),IgnoreCase);
       UnicodeCharClass.AddChar(ord('('),IgnoreCase);
       UnicodeCharClass.AddChar(ord('!'),IgnoreCase);
       UnicodeCharClass.AddChar(ord(')'),IgnoreCase);
       UnicodeCharClass.AddChar(ord('*'),IgnoreCase);
       UnicodeCharClass.AddChar(ord('+'),IgnoreCase);
       UnicodeCharClass.AddChar(ord(','),IgnoreCase);
       UnicodeCharClass.AddChar(ord('\'),IgnoreCase);
       UnicodeCharClass.AddChar(ord('-'),IgnoreCase);
       UnicodeCharClass.AddChar(ord('.'),IgnoreCase);
       UnicodeCharClass.AddChar(ord('/'),IgnoreCase);
       UnicodeCharClass.AddChar(ord(':'),IgnoreCase);
       UnicodeCharClass.AddChar(ord(';'),IgnoreCase);
       UnicodeCharClass.AddChar(ord('<'),IgnoreCase);
       UnicodeCharClass.AddChar(ord('='),IgnoreCase);
       UnicodeCharClass.AddChar(ord('>'),IgnoreCase);
       UnicodeCharClass.AddChar(ord('?'),IgnoreCase);
       UnicodeCharClass.AddChar(ord('@'),IgnoreCase);
       UnicodeCharClass.AddChar(ord('['),IgnoreCase);
       UnicodeCharClass.AddChar(ord('^'),IgnoreCase);
       UnicodeCharClass.AddChar(ord('_'),IgnoreCase);
       UnicodeCharClass.AddChar(ord('`'),IgnoreCase);
       UnicodeCharClass.AddChar(ord('{'),IgnoreCase);
       UnicodeCharClass.AddChar(ord('|'),IgnoreCase);
       UnicodeCharClass.AddChar(ord('}'),IgnoreCase);
       UnicodeCharClass.AddChar(ord('~'),IgnoreCase);
      end;
      if CurrentChar='P' then begin
       UnicodeCharClass.Invert;
       UnicodeCharClass.Inverted:=false;
      end;
      UnicodeCharClass.Canonicalized:=true;
     end;
     'l','L':begin
      if rfUTF8 in Flags then begin
       UnicodeCharClass.AddUnicodeCategory(1 shl FLREUnicodeCategoryLl,IgnoreCase);
      end else begin
       UnicodeCharClass.AddRange(ord('a'),ord('z'),IgnoreCase);
      end;
      if CurrentChar='L' then begin
       UnicodeCharClass.Invert;
       UnicodeCharClass.Inverted:=false;
      end;
      UnicodeCharClass.Canonicalized:=true;
     end;
     'u','U':begin
      if rfUTF8 in Flags then begin
       UnicodeCharClass.AddUnicodeCategory(1 shl FLREUnicodeCategoryLu,IgnoreCase);
      end else begin
       UnicodeCharClass.AddRange(ord('A'),ord('Z'),IgnoreCase);
      end;
      if CurrentChar='U' then begin
       UnicodeCharClass.Invert;
       UnicodeCharClass.Inverted:=false;
      end;
      UnicodeCharClass.Canonicalized:=true;
     end;
     else begin
      UnicodeCharClass.AddChar(ord(CurrentChar),IgnoreCase);
      UnicodeCharClass.Canonicalized:=true;
     end;
    end;
   end;
   procedure GetCharClassPerName(const Name:ansistring;const UnicodeCharClass:TFLREUnicodeCharClass;const IgnoreCase:boolean);
   var i:longint;
       f:int64;
   begin
    begin
     f:=UnicodeClassHashMap[Name];
     if f>0 then begin
      UnicodeCharClass.AddUnicodeCategory(f,IgnoreCase);
      UnicodeCharClass.Canonicalized:=true;
      exit;
     end;
    end;
    begin
     f:=UnicodeScriptHashMap[Name];
     if f>0 then begin
      UnicodeCharClass.AddUnicodeScript(f,IgnoreCase);
      UnicodeCharClass.Canonicalized:=true;
      exit;
     end;
    end;
    begin
     f:=UnicodeBlockHashMap[Name];
     if f>0 then begin
      UnicodeCharClass.AddUnicodeBlock(f,IgnoreCase);
      UnicodeCharClass.Canonicalized:=true;
      exit;
     end;
    end;
    if Name='alnum' then begin
     if rfUTF8 in Flags then begin
      UnicodeCharClass.AddUnicodeCategory((1 shl FLREUnicodeCategoryLu) or (1 shl FLREUnicodeCategoryLl) or (1 shl FLREUnicodeCategoryLt) or (1 shl FLREUnicodeCategoryNd),IgnoreCase);
     end else begin
      UnicodeCharClass.AddRange(ord('a'),ord('z'),IgnoreCase);
      UnicodeCharClass.AddRange(ord('A'),ord('Z'),IgnoreCase);
      UnicodeCharClass.AddRange(ord('0'),ord('9'),IgnoreCase);
     end;
     UnicodeCharClass.Canonicalized:=true;
    end else if Name='alpha' then begin
     if rfUTF8 in Flags then begin
      UnicodeCharClass.AddUnicodeCategory((1 shl FLREUnicodeCategoryLu) or (1 shl FLREUnicodeCategoryLl) or (1 shl FLREUnicodeCategoryLt),IgnoreCase);
     end else begin
      UnicodeCharClass.AddRange(ord('a'),ord('z'),IgnoreCase);
      UnicodeCharClass.AddRange(ord('A'),ord('Z'),IgnoreCase);
     end;
     UnicodeCharClass.Canonicalized:=true;
    end else if Name='ascii' then begin
     UnicodeCharClass.AddRange($00,$7f,IgnoreCase);
     UnicodeCharClass.Canonicalized:=true;
    end else if Name='blank' then begin
     if rfUTF8 in Flags then begin
      UnicodeCharClass.AddUnicodeCategory(1 shl FLREUnicodeCategoryZs,IgnoreCase);
     end else begin
      UnicodeCharClass.AddChar(9,IgnoreCase);
      UnicodeCharClass.AddChar(32,IgnoreCase);
     end;
     UnicodeCharClass.Canonicalized:=true;
    end else if Name='cntrl' then begin
     if rfUTF8 in Flags then begin
      UnicodeCharClass.AddUnicodeCategory(1 shl FLREUnicodeCategoryCc,IgnoreCase);
     end else begin
      UnicodeCharClass.AddRange($00,$1f,IgnoreCase);
      UnicodeCharClass.AddChar($7f,IgnoreCase);
     end;
     UnicodeCharClass.Canonicalized:=true;
    end else if Name='digits' then begin
     if rfUTF8 in Flags then begin
      UnicodeCharClass.AddUnicodeCategory(1 shl FLREUnicodeCategoryNd,IgnoreCase);
     end else begin
      UnicodeCharClass.AddRange(ord('0'),ord('9'),IgnoreCase);
     end;
     UnicodeCharClass.Canonicalized:=true;
    end else if Name='graph' then begin
     if rfUTF8 in Flags then begin
      UnicodeCharClass.AddUnicodeCategory((1 shl FLREUnicodeCategoryZs) or (1 shl FLREUnicodeCategoryZl) or (1 shl FLREUnicodeCategoryZp) or (1 shl FLREUnicodeCategoryCc) or (1 shl FLREUnicodeCategoryCf) or (1 shl FLREUnicodeCategoryCo) or (1 shl FLREUnicodeCategoryCs) or (1 shl FLREUnicodeCategoryCn),IgnoreCase);
     end else begin
      UnicodeCharClass.AddRange($21,$7e,IgnoreCase);
     end;
     UnicodeCharClass.Canonicalized:=true;
    end else if Name='inbasiclatin' then begin
     UnicodeCharClass.AddRange($00,$7f,IgnoreCase);
     UnicodeCharClass.Canonicalized:=true;
    end else if (Name='inno_block') or (Name='isno_block') or (Name='innoblock') or (Name='isnoblock') then begin
     for i:=0 to FLREUnicodeBlockCount-1 do begin
      UnicodeCharClass.AddUnicodeBlock(i,false);
     end;
     UnicodeCharClass.Invert;
     UnicodeCharClass.Inverted:=false;
     if IgnoreCase then begin
      UnicodeCharClass.Canonicalize;
     end;
     UnicodeCharClass.Canonicalized:=true;
    end else if Name='lower' then begin
     if rfUTF8 in Flags then begin
      UnicodeCharClass.AddUnicodeCategory(1 shl FLREUnicodeCategoryLl,IgnoreCase);
     end else begin
      UnicodeCharClass.AddRange(ord('a'),ord('z'),IgnoreCase);
     end;
     UnicodeCharClass.Canonicalized:=true;
    end else if Name='print' then begin
     if rfUTF8 in Flags then begin
      UnicodeCharClass.AddUnicodeCategory((1 shl FLREUnicodeCategoryCc) or (1 shl FLREUnicodeCategoryCf) or (1 shl FLREUnicodeCategoryCo) or (1 shl FLREUnicodeCategoryCs) or (1 shl FLREUnicodeCategoryCn),IgnoreCase);
     end else begin
      UnicodeCharClass.AddRange($20,$7e,IgnoreCase);
     end;
     UnicodeCharClass.Canonicalized:=true;
    end else if Name='punct' then begin
     if rfUTF8 in Flags then begin
      UnicodeCharClass.AddUnicodeCategory((1 shl FLREUnicodeCategoryPd) or (1 shl FLREUnicodeCategoryPs) or (1 shl FLREUnicodeCategoryPe) or (1 shl FLREUnicodeCategoryPc) or (1 shl FLREUnicodeCategoryPo),IgnoreCase);
     end else begin
      UnicodeCharClass.AddChar(ord('!'),IgnoreCase);
      UnicodeCharClass.AddChar(ord('"'),IgnoreCase);
      UnicodeCharClass.AddChar(ord('#'),IgnoreCase);
      UnicodeCharClass.AddChar(ord('$'),IgnoreCase);
      UnicodeCharClass.AddChar(ord('%'),IgnoreCase);
      UnicodeCharClass.AddChar(ord('&'),IgnoreCase);
      UnicodeCharClass.AddChar(ord(''''),IgnoreCase);
      UnicodeCharClass.AddChar(ord('('),IgnoreCase);
      UnicodeCharClass.AddChar(ord('!'),IgnoreCase);
      UnicodeCharClass.AddChar(ord(')'),IgnoreCase);
      UnicodeCharClass.AddChar(ord('*'),IgnoreCase);
      UnicodeCharClass.AddChar(ord('+'),IgnoreCase);
      UnicodeCharClass.AddChar(ord(','),IgnoreCase);
      UnicodeCharClass.AddChar(ord('\'),IgnoreCase);
      UnicodeCharClass.AddChar(ord('-'),IgnoreCase);
      UnicodeCharClass.AddChar(ord('.'),IgnoreCase);
      UnicodeCharClass.AddChar(ord('/'),IgnoreCase);
      UnicodeCharClass.AddChar(ord(':'),IgnoreCase);
      UnicodeCharClass.AddChar(ord(';'),IgnoreCase);
      UnicodeCharClass.AddChar(ord('<'),IgnoreCase);
      UnicodeCharClass.AddChar(ord('='),IgnoreCase);
      UnicodeCharClass.AddChar(ord('>'),IgnoreCase);
      UnicodeCharClass.AddChar(ord('?'),IgnoreCase);
      UnicodeCharClass.AddChar(ord('@'),IgnoreCase);
      UnicodeCharClass.AddChar(ord('['),IgnoreCase);
      UnicodeCharClass.AddChar(ord('^'),IgnoreCase);
      UnicodeCharClass.AddChar(ord('_'),IgnoreCase);
      UnicodeCharClass.AddChar(ord('`'),IgnoreCase);
      UnicodeCharClass.AddChar(ord('{'),IgnoreCase);
      UnicodeCharClass.AddChar(ord('|'),IgnoreCase);
      UnicodeCharClass.AddChar(ord('}'),IgnoreCase);
      UnicodeCharClass.AddChar(ord('~'),IgnoreCase);
     end;
     UnicodeCharClass.Canonicalized:=true;
    end else if Name='space' then begin
     if rfUTF8 in Flags then begin
      for i:=0 to length(UnicodeCharRangeClasses[ucrWHITESPACES])-1 do begin
       UnicodeCharClass.AddRange(UnicodeCharRangeClasses[ucrWHITESPACES,i,0],UnicodeCharRangeClasses[ucrWHITESPACES,i,1],IgnoreCase);
      end;
     end else begin
      UnicodeCharClass.AddRange(9,13,IgnoreCase);
      UnicodeCharClass.AddChar(32,IgnoreCase);
     end;
    end else if Name='upper' then begin
     if rfUTF8 in Flags then begin
      UnicodeCharClass.AddUnicodeCategory(1 shl FLREUnicodeCategoryLu,IgnoreCase);
     end else begin
      UnicodeCharClass.AddRange(ord('A'),ord('Z'),IgnoreCase);
     end;
     UnicodeCharClass.Canonicalized:=true;
    end else if Name='word' then begin
     if rfUTF8 in Flags then begin
      for i:=0 to length(UnicodeCharRangeClasses[ucrWORDS])-1 do begin
       UnicodeCharClass.AddRange(UnicodeCharRangeClasses[ucrWORDS,i,0],UnicodeCharRangeClasses[ucrWORDS,i,1],IgnoreCase);
      end;
     end else begin
      UnicodeCharClass.AddRange(ord('a'),ord('z'),IgnoreCase);
      UnicodeCharClass.AddRange(ord('A'),ord('Z'),IgnoreCase);
      UnicodeCharClass.AddRange(ord('0'),ord('9'),IgnoreCase);
      UnicodeCharClass.AddChar(ord('_'),IgnoreCase);
     end;
     UnicodeCharClass.Canonicalized:=true;
    end else if Name='xdigit' then begin
     UnicodeCharClass.AddRange(ord('a'),ord('f'),IgnoreCase);
     UnicodeCharClass.AddRange(ord('A'),ord('f'),IgnoreCase);
     UnicodeCharClass.AddRange(ord('0'),ord('9'),IgnoreCase);
     UnicodeCharClass.Canonicalized:=true;
    end else begin
     raise EFLRE.Create('Syntax error');
    end;
   end;
  