constructor TniExtendedRegularExpression.Create( const sRegularExpression: string;
xFlags: TniRegularExpressionMatchFlags);
var
sExpression: string;
begin
inherited Create;
FoSubExpressions:= TStringList.Create;
FoMatches:= TStringList.Create;
FoIdentifiers:= TStringList.Create;
FsExpression:= sRegularExpression;
sExpression:= sRegularExpression;
FxFlags:= xFlags;
FxSubExpressionFlags:= xFlags + [mfOverlapMatches, mfMultipleMatches]
- [mfLongMatches, mfShortMatches];
if xFlags * [ mfMultipleMatches, mfOverlapMatches ] <> [] then
raise EniRegularExpressionError.Create( csNotSupported);
if mfStartOnly in FxFlags then begin
Insert( '^', sExpression, 1);
Exclude( FxSubExpressionFlags, mfStartOnly);
end;
if mfFinishOnly in FxFlags then begin
Insert( '$', sExpression, Length(sExpression));
Exclude( FxSubExpressionFlags, mfFinishOnly);
end;
ParseExpression( sExpression);
End; |