Hi,
With FPC V3.0.4 a worksheet could be searched without problems using regular expressions. Function TRegExpr.ExecPrim() in unit RegExpr.pas used to throw an 'empty input string' error if the string wasn't assigned, however with changes to package regexpr in V3.2.0, the error is raised if the string is empty. As most cells in a worksheet are empty, it is inevitable that this error is raised.
A check in TsSearchEngine.Matches() fixes this problem.
function TsSearchEngine.Matches(AWorksheet: TsWorksheet; ARow, ACol: Cardinal): Boolean;
var
cell: PCell;
txt: String;
begin
cell := AWorksheet.FindCell(ARow, ACol);
txt := '';
if cell <> nil then
begin
if (soSearchInComment in FSearchParams.Options) then
txt := AWorksheet.ReadComment(cell)
else
txt := AWorksheet.ReadAsText(cell);
end;
//--- Check added for empty string
if txt.IsEmpty then
exit(false);
//---
if soRegularExpr in FSearchParams.Options then
Result := FRegEx.Exec(txt)
else
begin
if not (soMatchCase in FSearchParams.Options) then
txt := UTF8Lowercase(txt);
if soCompareEntireCell in FSearchParams.Options then
exit(txt = FSearchText);
if pos(FSearchText, txt) > 0 then
exit(true);
Result := false;
end;
end;