# Regex to match a phrase

**URL:** <https://community.mp3tag.de/t/regex-to-match-a-phrase/48797>\
**Category:** Web Sources Discussion\
**Created:** [April 29, 2020, 8:04pm UTC](https://community.mp3tag.de/t/regex-to-match-a-phrase/48797 "2020-04-29T20:04:03Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Romano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/romano/32/7465_2.png) [@Romano](https://community.mp3tag.de/u/Romano)\
**Post date:** [April 29, 2020, 8:04pm UTC](https://community.mp3tag.de/t/regex-to-match-a-phrase/48797/1 "2020-04-29T20:04:04Z")

</div>

what is the regex to search for a phrase or a word? to mach exacly, i mean if a search for moon, i dont per example moonrise?  
[SearchBy]=%album%

edit: i guess i solve it?  
[SearchBy]=$regexp(%album%,\b(\w\*%album%)\b,,1)  
edit2: nope

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [April 30, 2020, 4:39am UTC](https://community.mp3tag.de/t/regex-to-match-a-phrase/48797/2 "2020-04-30T04:39:49Z")

</div>

$regexp(Moon rise,\bMoon\b,)  
leads to "rise"  
$regexp(Moonrise,\bMoon\b,)  
results in "Moonrise"

---

<div class="post-metadata">

**Author:** ![Romano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/romano/32/7465_2.png) [@Romano](https://community.mp3tag.de/u/Romano)\
**Post date:** [April 30, 2020, 3:44pm UTC](https://community.mp3tag.de/t/regex-to-match-a-phrase/48797/4 "2020-04-30T15:44:33Z")

</div>

How about to match a full phrase and nothing more?

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [April 30, 2020, 3:58pm UTC](https://community.mp3tag.de/t/regex-to-match-a-phrase/48797/5 "2020-04-30T15:58:36Z")

</div>

what do you mean? Something that ends with a full stop, question mark or exclamation mark?  
`$regexp('Some sentence? And another one.','.*?[.!?] (.*)',$1)`  
leads to  
"And another one."  
If you want to compare string constants, and not patterns, try $strstr()

---

<div class="post-metadata">

**Author:** ![Romano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/romano/32/7465_2.png) [@Romano](https://community.mp3tag.de/u/Romano)\
**Post date:** [April 30, 2020, 4:02pm UTC](https://community.mp3tag.de/t/regex-to-match-a-phrase/48797/6 "2020-04-30T16:02:46Z")

</div>

i mean that match exactly the pharse when i search.

per example:

%album%= moon in the sky

if i search it gives me "moonrise"  
i don't know if i am getting explain, english is not my first language.

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [April 30, 2020, 4:13pm UTC](https://community.mp3tag.de/t/regex-to-match-a-phrase/48797/7 "2020-04-30T16:13:36Z")

</div>

so this not really a question for a regexp but how a search engine interprets a string?  
Usually you enclose a term that is to be taken as one piece into " or join the individual parts with &

---

<div class="post-metadata">

**Author:** ![Romano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/romano/32/7465_2.png) [@Romano](https://community.mp3tag.de/u/Romano)\
**Post date:** [April 30, 2020, 8:07pm UTC](https://community.mp3tag.de/t/regex-to-match-a-phrase/48797/8 "2020-04-30T20:07:31Z")

</div>

@ohrenkino i dont think so, let me explain better:

1 - I made a web source to only fech author and description bio.  
[Goodreads#Author image.src](https://community.mp3tag.de/uploads/short-url/9u1ZHHixnJAHrwrB0L3YoZkJnX1.src) (2.3 KB)

2-i search for per example: Moon James Herbert (album and author)

3- the result is: hebert james hall and not moon by james hebert.  
 ![](https://community.mp3tag.de/uploads/default/original/2X/0/09807aaaa4f47e2c308911543bde00ff987cd925.png)

4-i put the search text inside the search box: Moon James Herbert, and it gives the correct book/author:

 ![](https://community.mp3tag.de/uploads/default/original/2X/7/7d608925c685ccedcf266fb7da2745a396857c39.png)

if i search only for the author it is ok., i put in the album name to be more accurate.  
So i assume that it needs to get the full album+author exacly.  
how can i do that?

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [April 30, 2020, 8:22pm UTC](https://community.mp3tag.de/t/regex-to-match-a-phrase/48797/9 "2020-04-30T20:22:15Z")

</div>

I do not write web sources.  
And actually, I do not want to dig into the intricacies of the search on that web page to get a closer result.  
Yet, if I look at e.g. the discogs script that searches for artist and album, then the search string processing is much more complex than just the simple naming of 2 fields.  
Perhaps you compare your input and what the resulting url looks like.  
But this is just guess work and I do not think that I can really help you with this.
