QuickList.BestMatch
-------------------

Looks for best match of a text in a list of texts.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [List](component_List.md) | [5.0](newinversion50.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "QuickList.BestMatch"; ListRef; SearchText { ; Flags } ) 

**MBS**( **"QuickList.BestMatch";** /\* Looks for best match of a text in a list of texts. \*/  
**$ListRef**; /\* The reference to the list returned from [QuickList.New](QuickListNew.md) function.e.g. $List \*/   
**$SearchText**; /\* The text to search.e.g. "Hello" \*/   
**$Flags**) /\* Optional; Pass 0 to use Levenshtein distance.  
Pass 1 to use Jaro-Winkler distance.  
Add 2 to return list of top 5 entries.e.g. 0 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| ListRef | The reference to the list returned from [QuickList.New](QuickListNew.md) function. | $List |  |
| SearchText | The text to search. | "Hello" |  |
| Flags | Pass 0 to use Levenshtein distance.   Pass 1 to use Jaro-Winkler distance.   Add 2 to return list of top 5 entries. | 0 | Optional      Added in version **14.0**. |

### Result

Returns best match, empty or error.

### Description

Looks for best match of a text in a list of texts.  
If not found, returns empty result, so FileMaker function isEmpty() will tell you if it's empty (instead of just having no text).  
Uses internally the [Text.LevenshteinDistance](TextLevenshteinDistance.md) function to compare all items and look for best match.  
If no entry matches over 50%, this may return empty text.  
### See also

- [List.BestMatch](ListBestMatch.md)
- [QuickList.New](QuickListNew.md)
- [QuickList.RegExMatch](QuickListRegExMatch.md)
- [Text.LevenshteinDistance](TextLevenshteinDistance.md)

### Release notes

- **Version 14.0**
    - Added flags for [List.BestMatch](https://www.mbsplugins.eu/ListBestMatch.shtml) and [QuickList.BestMatch](https://www.mbsplugins.eu/QuickListBestMatch.shtml) to use Jaro-Winkler distance optionally and optionally return list of top 5.

### Blog Entries

- [MBS FileMaker Plugin, version 13.6pr1](https://www.mbsplugins.de/archive/2023-12-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin debugging help](https://www.mbsplugins.de/archive/2015-02-27/MBS_FileMaker_Plugin_debugging/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin, version 4.5pr4](https://www.mbsplugins.de/archive/2014-12-19/MBS_Filemaker_Plugin_version_4/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 11st December 2014 , last changed 10th November 2023

  
[QuickList.AndColumn](QuickListAndColumn.md) - [QuickList.CSVSplit](QuickListCSVSplit.md)

[HTML Version](QuickListBestMatch.shtml)