# Regex query across all fields

**URL:** <https://discourse.beets.io/t/regex-query-across-all-fields/479>\
**Category:** Help\
**Created:** [September 28, 2018, 11:17pm UTC](https://discourse.beets.io/t/regex-query-across-all-fields/479 "2018-09-28T23:17:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pauper](https://avatars.discourse-cdn.com/v4/letter/p/c57346/32.png) [@pauper](https://discourse.beets.io/u/pauper)\
**Post date:** [September 28, 2018, 11:17pm UTC](https://discourse.beets.io/t/regex-query-across-all-fields/479/1 "2018-09-28T23:17:35Z")

</div>

Trying to weed out tracks with acousticbrainz values stored as strings as per this issue:

> <https://github.com/beetbox/beets/issues/2790>
>
> \### Problem
> 
> Using the acousticbrainz plugin (I don't know if it's specific to… it, it might be a wider issue), when storing really small values, they end up formatted in an exponential style, e.g. \`1.82764233614e-05\`. As a result, the whole (flexible, in this case) attribute ends up being treated as a string - which forbids using ranges in query, for example.
> 
> Here's an example with the recording \`9dcdb20b-3bdf-4d1f-842f-d3cb545bea28\` on MusicBrainz. The \`mood\_happy\` probability is really low on AcousticBrainz: http://acousticbrainz.org/api/v1/9dcdb20b-3bdf-4d1f-842f-d3cb545bea28/high-level?n=0 (field value is \`0.0000182764233614\`). In beets, it ends up being stored as \`1.82764233614e-05\`:
> 
> \`\`\`sh
> $ beet -vv acousticbrainz M83 Ludivine -f
> user configuration: /root/.config/beets/config.yaml
> data directory: /root/.config/beets
> plugin paths: /root/.config/beets/beets-alternatives/beetsplug
> Sending event: pluginload
> lyrics: Disabling google source: no API key configured.
> inline: adding item field disc\_with\_title
> inline: adding album field spinnin\_catalognum
> library database: /root/.config/beets/beets.blb
> library directory: /media/sao/Musique
> Sending event: library\_opened
> acousticbrainz: getting data for: M83 - Junk - Ludivine
> acousticbrainz: fetching URL: https://acousticbrainz.org/9dcdb20b-3bdf-4d1f-842f-d3cb545bea28/low-level
> acousticbrainz: fetching URL: https://acousticbrainz.org/9dcdb20b-3bdf-4d1f-842f-d3cb545bea28/high-level
> acousticbrainz: attribute danceable of M83 - Junk - Ludivine set to 0.00766881043091
> acousticbrainz: attribute gender of M83 - Junk - Ludivine set to male
> acousticbrainz: attribute genre\_rosamerica of M83 - Junk - Ludivine set to cla
> acousticbrainz: attribute mood\_acoustic of M83 - Junk - Ludivine set to 0.995353162289
> acousticbrainz: attribute mood\_aggressive of M83 - Junk - Ludivine set to 0.042748786509
> acousticbrainz: attribute mood\_electronic of M83 - Junk - Ludivine set to 0.0935237780213
> acousticbrainz: attribute mood\_happy of M83 - Junk - Ludivine set to 1.82764233614e-05
> acousticbrainz: attribute mood\_party of M83 - Junk - Ludivine set to 0.0153690651059
> acousticbrainz: attribute mood\_relaxed of M83 - Junk - Ludivine set to 0.987963736057
> acousticbrainz: attribute mood\_sad of M83 - Junk - Ludivine set to 0.956809282303
> acousticbrainz: attribute rhythm of M83 - Junk - Ludivine set to Tango
> acousticbrainz: attribute tonal of M83 - Junk - Ludivine set to 0.435981780291
> acousticbrainz: attribute voice\_instrumental of M83 - Junk - Ludivine set to instrumental
> acousticbrainz: attribute average\_loudness of M83 - Junk - Ludivine set to 0.753472864628
> acousticbrainz: attribute bpm of M83 - Junk - Ludivine set to 106.67628479
> acousticbrainz: attribute chords\_changes\_rate of M83 - Junk - Ludivine set to 0.0346172600985
> acousticbrainz: attribute chords\_key of M83 - Junk - Ludivine set to D
> acousticbrainz: attribute chords\_number\_rate of M83 - Junk - Ludivine set to 0.00487567018718
> acousticbrainz: attribute chords\_scale of M83 - Junk - Ludivine set to major
> acousticbrainz: attribute key\_strength of M83 - Junk - Ludivine set to 0.704598069191
> acousticbrainz: attribute initial\_key of M83 - Junk - Ludivine set to F# minor
> Sending event: database\_change
> Sending event: write
> \`\`\`
> 
> \### Setup
> 
> \* OS: Linux
> \* Python version: 3.6.4
> \* beets version: 1.4.6
> \* Turning off plugins made problem go away (yes/no): irrelevant, I guess
> 
> My configuration (output of \`beet config\`) is: probably irrelevant too, I just have the plugin enabled without any configuration.

I’m having trouble getting the query right to search all fields:

> beet list -f ‘$path’ “:\[1\].[0-9]+e-[0-9]{2}$”

produces no results, but:

> beet list -f ‘$path’ “mood\_aggressive::\[2\].[0-9]+e-[0-9]{2}$”

will show tracks with these string values for mood\_aggressive (or any single specified field). Am I doing something wrong?

* * *

1. 0-9 

2. 0-9

---

<div class="post-metadata">

**Author:** ![adrian](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/adrian/32/4_2.png) [@adrian](https://discourse.beets.io/u/adrian)\
**Post date:** [September 29, 2018, 1:46pm UTC](https://discourse.beets.io/t/regex-query-across-all-fields/479/2 "2018-09-29T13:46:15Z")

</div>

Using a single leading : will search across all the _default_ fields (i.e., the same set of fields as a plain, non-prefixed query). For example:

```nohighlight
$ beet ls ':99[\d\s]'
Crystal Castles - Crystal Castles - 1991
DJ Danger Mouse - The Grey Album - 99 Problems

```

We don’t currently have a way to express a query that searches across _all_ fields, including those flexible attributes defined by a plugin. That could be an interesting addition, though!

---

<div class="post-metadata">

**Author:** ![pauper](https://avatars.discourse-cdn.com/v4/letter/p/c57346/32.png) [@pauper](https://discourse.beets.io/u/pauper)\
**Post date:** [September 29, 2018, 6:14pm UTC](https://discourse.beets.io/t/regex-query-across-all-fields/479/3 "2018-09-29T18:14:01Z")

</div>

I knew there was something I musn’t have been understanding. It’d be great if that could be incorporated in a future release.
