# Remove text from tag, keep numbers

**URL:** <https://community.mp3tag.de/t/remove-text-from-tag-keep-numbers/55638>\
**Category:** Support\
**Created:** [December 28, 2021, 2:20pm UTC](https://community.mp3tag.de/t/remove-text-from-tag-keep-numbers/55638 "2021-12-28T14:20:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![blackfiction](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/aeb1de/32.png) [@blackfiction](https://community.mp3tag.de/u/blackfiction)\
**Post date:** [December 28, 2021, 2:20pm UTC](https://community.mp3tag.de/t/remove-text-from-tag-keep-numbers/55638/1 "2021-12-28T14:20:38Z")

</div>

Hi, I am pretty new at this and can not figure out how to remove all text before the numbers. I have a tag called OPUS, which contains text and a number.  
I would like to have

1. a OPUSSORT tag which only contains numbers.  
For example;  
opus = T. 65  
opussort would be 65  
opus = BWV 1003a  
opussort would be 1003

2. a OPUSNUMBER tag which contains the numbers and the text thereafter.  
For example;  
opus = T. 65  
opusnumber would be 65  
opus = BWV 1003a  
opusnumber would be 1003a

Hope someone can help me with writing the action codes for these 2,  
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:** [December 28, 2021, 2:33pm UTC](https://community.mp3tag.de/t/remove-text-from-tag-keep-numbers/55638/2 "2021-12-28T14:33:45Z")

</div>

> [@blackfiction](#):
>
> BWV 1003a

Try an action of the type "Format value" for OPUSSORT with  
Format string: `$regexp(%opus%,.*?(\d+.*),$1)`

Try an action of the type "Format value" for OPUSNUMBER with  
Format string: `$num($regexp(%opus%,.*?(\d+.*),$1),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:** [January 27, 2022, 2:34pm UTC](https://community.mp3tag.de/t/remove-text-from-tag-keep-numbers/55638/3 "2022-01-27T14:34:06Z")

</div>

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