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

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

$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

howdy DetlevD,

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

take care,
lee