# Left priority in dropdown search

**URL:** https://community.plotly.com/t/left-priority-in-dropdown-search/29104
**Category:** Dash Python
**Created:** [September 23, 2019, 2:36pm UTC](https://community.plotly.com/t/left-priority-in-dropdown-search/29104 "2019-09-23T14:36:30Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![meaydemi](https://avatars.discourse-cdn.com/v4/letter/m/e495f1/32.png) [@meaydemi](https://community.plotly.com/u/meaydemi)
#### Post date: [September 23, 2019, 2:36pm UTC](https://community.plotly.com/t/left-priority-in-dropdown-search/29104/1 "2019-09-23T14:36:30Z")

</div>

Say I have two labels in my dropdown:

ab  
b

If I were to search “b” I would see “ab” above “b” in the dropdown options. Is there a way to make the search read from the left so that we see “b” above “ab” in the dropdown options?

---

<div class="post-metadata">

### Author: ![marketemp](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/marketemp/32/11523_2.png) [@marketemp](https://community.plotly.com/u/marketemp)
#### Post date: [May 6, 2020, 8:02pm UTC](https://community.plotly.com/t/left-priority-in-dropdown-search/29104/2 "2020-05-06T20:02:17Z")

</div>

chriddyp pointed me to the Dynamic Options example on [https://dash.plotly.com/dash-core-components/dropdown](https://dash.plotly.com/dash-core-components/dropdown) and I solved it using:

return [o for o in options if re.match(search\_value, o[“label”], re.IGNORECASE)]

for front matches only or:

opt = [o for o in options if re.match(search\_value, o[“label”], re.IGNORECASE)]  
opt.extend([o for o in options if o not in opt and search\_value in o[“label”]])  
return opt

---

<div class="post-metadata">

### Author: ![meaydemi](https://avatars.discourse-cdn.com/v4/letter/m/e495f1/32.png) [@meaydemi](https://community.plotly.com/u/meaydemi)
#### Post date: [May 7, 2020, 4:35pm UTC](https://community.plotly.com/t/left-priority-in-dropdown-search/29104/3 "2020-05-07T16:35:55Z")

</div>

thanks market, very much appreciated
