# i'm stuck on a regex for a|an|and

**URL:** https://community.mp3tag.de/t/im-stuck-on-a-regex-for-a-an-and/11946
**Category:** Support
**Created:** [May 1, 2011, 2:52am UTC](https://community.mp3tag.de/t/im-stuck-on-a-regex-for-a-an-and/11946 "2011-05-01T02:52:32Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Lee\_Dailey](https://community.mp3tag.de/user_avatar/community.mp3tag.de/lee_dailey/32/4832_2.png) [@Lee\_Dailey](https://community.mp3tag.de/u/Lee_Dailey)
#### Post date: [May 1, 2011, 2:52am UTC](https://community.mp3tag.de/t/im-stuck-on-a-regex-for-a-an-and/11946/1 "2011-05-01T02:52:32Z")

</div>

howdy y'all,

os = win7, sp1  
mp3tag = 2.48d

i've a regex that is supposed to lowercase any 'a', 'an' or 'and' found inside a string. for example ...  
source = Lover And A Friend  
expected result = Lover and a Friend  
actual result = Lover and A Friend

here's the code ...  
field = \_TAG  
regex = \s(a|an|and)\s  
replace matches with = $lower($0)  
case sensitive = no

my guess is that the regex considers the space between the 'and' and the 'a' to belong to the 1st match & it doesn't see a match on the second item.

[1] am i correct about why it is failing?  
if not i will greatly appreciate some help understanding what is going on here. [_grin_]

[2] is there a better or more effective method?

i've been using that regex for more than a year and this is the 1st time i've had the two words in sequence. well, the 1st time i've noticed it. [_blush_]

take care,  
lee

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [May 1, 2011, 3:28am UTC](https://community.mp3tag.de/t/im-stuck-on-a-regex-for-a-an-and/11946/2 "2011-05-01T03:28:46Z")

</div>

> [@Lee\_Dailey](#):
>
> regex = \s(a|an|and)\s  
> replace matches with = $lower($0)

**$regexp('Lover And A Friend','\b(a|an|and)\b','\L$1',1)**

From:  
Lover And A Friend  
To:  
Lover and a Friend

DD.20110501.0744.CEST

---

<div class="post-metadata">

### Author: ![Lee\_Dailey](https://community.mp3tag.de/user_avatar/community.mp3tag.de/lee_dailey/32/4832_2.png) [@Lee\_Dailey](https://community.mp3tag.de/u/Lee_Dailey)
#### Post date: [May 1, 2011, 6:00am UTC](https://community.mp3tag.de/t/im-stuck-on-a-regex-for-a-an-and/11946/3 "2011-05-01T06:00:53Z")

</div>

howdy DetlevD,

gak! [_blush_] i never thot to try using word boundaries. thanks for the heads up. [_grin_]

take care,  
lee

---

<div class="post-metadata">

### Author: ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)
#### Post date: [February 9, 2026, 12:23pm UTC](https://community.mp3tag.de/t/im-stuck-on-a-regex-for-a-an-and/11946/4 "2026-02-09T12:23:04Z")

</div>


