# Some help debugging regex please

**URL:** https://community.mp3tag.de/t/some-help-debugging-regex-please/9488
**Category:** Support
**Created:** [December 6, 2009, 5:40pm UTC](https://community.mp3tag.de/t/some-help-debugging-regex-please/9488 "2009-12-06T17:40:30Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![egd](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/e/3da27b/32.png) [@egd](https://community.mp3tag.de/u/egd)
#### Post date: [December 6, 2009, 5:40pm UTC](https://community.mp3tag.de/t/some-help-debugging-regex-please/9488/1 "2009-12-06T17:40:30Z")

</div>

I make use of an action in conjunction with a regex to generate Firstlettercaps strings for all words in a string, excepting a predefined list of words which should always be formatted lowercase. The regex works for the most part, but I do get exceptions, e.g. "I'm" and/or "i'm" returns "I'M" instead of "I'm". As it turns out, I'm unable to spot my error, so I'm hoping someone out there can give me a hand. Here's the code:

```
Firstly, I apply a case conversion Mixed case action, with words beginning after any of: .([/"

Then I apply a regex as follows:
\b(?:M{0,3})(?:D?C{0,3}|C[DM])(?:L?X{0,3}|X[LC])(?:V?I{0,3}|I[VX])(?=(\.\s|\s|\)|$))
replace matches with $upper($0)

followed by another regex as follows:
\s(a|an|and|as|at|by|but|de|di|en|for|from|in|is|of|on|op|or|out|the|to|van|
with)(?=\s)
replace matches with $lower($0)

```

Hmm, now if only I could edit the topic header or delete the post I'd correct the subject error!

---

<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: [December 6, 2009, 6:44pm UTC](https://community.mp3tag.de/t/some-help-debugging-regex-please/9488/2 "2009-12-06T18:44:42Z")

</div>

Your actions work for the most cases, and you got only a few exceptions?  
Then add some action to handle the exceptions, e. g. simply replace "I'M" with "I'm".

DD.20091206.2044.CET

---

<div class="post-metadata">

### Author: ![egd](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/e/3da27b/32.png) [@egd](https://community.mp3tag.de/u/egd)
#### Post date: [December 7, 2009, 4:24pm UTC](https://community.mp3tag.de/t/some-help-debugging-regex-please/9488/3 "2009-12-07T16:24:40Z")

</div>

Thx, that'd work, but the purist in me wants to know what's wrong with the regex 😉

---

<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: [December 7, 2009, 4:59pm UTC](https://community.mp3tag.de/t/some-help-debugging-regex-please/9488/4 "2009-12-07T16:59:04Z")

</div>

Just a quick hack, not tested thoroughly ...

```
$regexp('I''''m so dizzy about mclxi''''s letters','[^''''|\b](?i:(?=[MDCLXVI])((M{0,3})((C[DM])|(D?C{0,3}))?((X[LC])|(L?XX{0,2})|L)?((I[VX])|(V?(II{0,2}))|V)?))[\b|^'''']','\U$0')

From:
I'm so dizzy about mclxi's letters
To:
I'm so dizzy about MCLXI's letters

```

Same as above wrapped into an action:  
Action #1  
_Actiontype 4:_ **Replace with regular expression**  
_Field:_ **EGD**  
_Regular expression:_ **^'|\b[\b|^']**  
_Replace matches with:_ **\U$0**

[\_] Case sensitive comparison

DD.20091207.1858.CET  
Edit. DD.20091208.0710

---

<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:22pm UTC](https://community.mp3tag.de/t/some-help-debugging-regex-please/9488/5 "2026-02-09T12:22:00Z")

</div>


