# RegExp to isolate disc/track# leaves 0 and 0/0 untouched

**URL:** https://community.mp3tag.de/t/regexp-to-isolate-disc-track-leaves-0-and-0-0-untouched/70877
**Category:** Support
**Created:** [March 14, 2026, 10:29pm UTC](https://community.mp3tag.de/t/regexp-to-isolate-disc-track-leaves-0-and-0-0-untouched/70877 "2026-03-14T22:29:58Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![UserWithName](https://community.mp3tag.de/user_avatar/community.mp3tag.de/userwithname/32/22243_2.png) [@UserWithName](https://community.mp3tag.de/u/UserWithName)
#### Post date: [March 14, 2026, 10:29pm UTC](https://community.mp3tag.de/t/regexp-to-isolate-disc-track-leaves-0-and-0-0-untouched/70877/1 "2026-03-14T22:29:58Z")

</div>

I want for track# and disc# only no zero values w/o leading zeros, e.g.

```auto
0/0 → 
0 →
01/0 → 1
02/02 → 2
1 → 1
2 → 2
3 34 → 3

```

But using

```auto
^[\s0]*([1-9]\d*).*$ ⟶ $1

```

works for every example above (and a lot of others) besides “0/0” and “0”. These left unexpectedly untouched. The expression matches, but maybe the empty result for the only capturing group is the reason? I tried to circumvent this by

```auto
^([\s0]*)([1-9]\d*)(.*)$ ⟶ $2

```

no luck, currently I use a 2nd to clean up

```auto
^(0|0/0)$ ⟶ 

```

I’ m just curious what’s the reason may be, thanks.

---

<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: [March 14, 2026, 10:35pm UTC](https://community.mp3tag.de/t/regexp-to-isolate-disc-track-leaves-0-and-0-0-untouched/70877/2 "2026-03-14T22:35:51Z")

</div>

You could also use `$grtr($num(%track%,1),0)`  
or  
`$ifgreater($num(%track%,1),0,yes,no)`

---

<div class="post-metadata">

### Author: ![UserWithName](https://community.mp3tag.de/user_avatar/community.mp3tag.de/userwithname/32/22243_2.png) [@UserWithName](https://community.mp3tag.de/u/UserWithName)
#### Post date: [March 14, 2026, 11:24pm UTC](https://community.mp3tag.de/t/regexp-to-isolate-disc-track-leaves-0-and-0-0-untouched/70877/3 "2026-03-14T23:24:37Z")

</div>

Oh, thanks, good suggestion — I was probably overly focused on regular expressions. This works in a single command.

```auto
$ifgreater($num(%track%,1),0,$num(%track%,1),)

```

---

<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: [March 21, 2026, 11:25pm UTC](https://community.mp3tag.de/t/regexp-to-isolate-disc-track-leaves-0-and-0-0-untouched/70877/4 "2026-03-21T23:25:32Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
