Code Explainers

Code explainers tagged #string-matching

typescript
type MatchSegment = {
  text: string;
  matched: boolean;
};

Splitting text into highlighted match segments

regex string-matching text-highlighting
Intermediate 8 steps
php
function fuzzySearch(string $query, array $items, int $limit = 10): array
{
    $query = mb_strtolower(trim($query));
 

Building a ranked fuzzy search in PHP

fuzzy-search string-matching ranking
Intermediate 7 steps