How to use regex in search?

Hi all,

I’m trying to do a Regex search via https://musicbrainz.org/search but I’m having trouble getting it to work.
If I try /[mb]oat/ like in the example in (1), it returns hits with mb and oat as well, and no boat or moat. Double quoting the query doesn’t help either.

What am I doing wrong? Any thoughts on how to get Regex to work as search item?

Thanks in advance

(1) https://lucene.apache.org/core/4_3_0/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#package_description

1 Like

This seems to work: advanced “releasegroup:/[lm]ove/” release group search.

I see love and move results and no lm nor ove results.

You have to select method=advanced and to set your regular expression on a specific search field like here releasegroup:/[lm]ove/.

1 Like

That does work! thanks!

The release that came up for me first was ‘I Love You’ by Thom Hell.
Now I’m trying a more advanced query;
I would like to find this release by only looking for the first letter of each word like this:

releasegroup:/i[^ ]* l[^ ]* y[^ ]*/

However, this doesn’t return any results.
https://regexr.com/ tells me the query is valid.
Any thoughts on how to solve this?

Thank you

Edit: updated query

1 Like

The search only takes your regex and apply it to each word.
You cannot regex match on the whole string, only word by word… I read that long time ago in Lucene docs.

I think what you want is then releasegroup:/^i.+/ AND releasegroup:/^l.+/ AND releasegroup:/^y.+/ (or, well, not really, because you cannot determine the order of searched words).