Skip to content

PdfPageText.allMatches: dead and inverted caseInsensitive assignment for RegExp patterns #679

Description

@espresso3389

Found while porting pdfrx_engine text APIs to TypeScript, by code inspection.

packages/pdfrx_engine/lib/src/pdf_text.dart, PdfPageText.allMatches():

if (pattern is RegExp) {
  caseInsensitive = pattern.isCaseSensitive;  // <-- inverted naming
  text = fullText;
} else if (pattern is String) {
  pattern = caseInsensitive ? pattern.toLowerCase() : pattern;
  text = caseInsensitive ? fullText.toLowerCase() : fullText;
}

The assignment caseInsensitive = pattern.isCaseSensitive is semantically inverted (isCaseSensitive == true would set caseInsensitive = true). It has no functional impact because caseInsensitive is never read after the RegExp branch (the RegExp handles its own case sensitivity), so this is dead-but-misleading code. Suggest removing the assignment (or, if it was meant to be surfaced somewhere, fixing the inversion).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions