# PERL-modifier for a less dense regular expression syntax

**URL:** <https://community.mp3tag.de/t/perl-modifier-for-a-less-dense-regular-expression-syntax/61073>\
**Category:** Support\
**Created:** [May 26, 2023, 10:36am UTC](https://community.mp3tag.de/t/perl-modifier-for-a-less-dense-regular-expression-syntax/61073 "2023-05-26T10:36:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ragtag](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ragtag/32/13146_2.png) [@ragtag](https://community.mp3tag.de/u/ragtag)\
**Post date:** [May 26, 2023, 10:36am UTC](https://community.mp3tag.de/t/perl-modifier-for-a-less-dense-regular-expression-syntax/61073/1 "2023-05-26T10:36:43Z")

</div>

Hello again, everybody.

Apparently, there is a modifier that could be used with which to increase the density of the regex syntax, in order to make it easier to read. The modifier is:

**/x**

I tried to test it, but failed to apply it correctly. Could someone please post an example of where this density modifier should be added to the regex syntaxes, or elsewhere, for it to increase the syntax density?

Thank you.

---

<div class="post-metadata">

**Author:** ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)\
**Post date:** [May 26, 2023, 11:05am UTC](https://community.mp3tag.de/t/perl-modifier-for-a-less-dense-regular-expression-syntax/61073/2 "2023-05-26T11:05:02Z")

</div>

What exactly should `/x` do in a regular expression ("density of the regex syntax")?  
Do you have a real example?

Or can it be that you mean [\X](https://stackoverflow.com/questions/9928505/what-does-the-expression-x-match-when-inside-a-regex)?

---

<div class="post-metadata">

**Author:** ![ragtag](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ragtag/32/13146_2.png) [@ragtag](https://community.mp3tag.de/u/ragtag)\
**Post date:** [May 26, 2023, 11:42am UTC](https://community.mp3tag.de/t/perl-modifier-for-a-less-dense-regular-expression-syntax/61073/3 "2023-05-26T11:42:35Z")

</div>

What it does, if I remember it correctly, it serves to spread the individual characters in the syntax out a bit, so they are easier to distinguish.

_Thanks for the link._

---

<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:** [May 26, 2023, 12:22pm UTC](https://community.mp3tag.de/t/perl-modifier-for-a-less-dense-regular-expression-syntax/61073/4 "2023-05-26T12:22:06Z")

</div>

What I have read: you may enter expressions in Perl code (not in MP3tag) so that individual parts are spread over several lines and comments may be added.  
E.g.

```auto
if (
        $line =~ /
        ^\s* # starting with zero or more spaces
        package
        \s+ # at least one space
        (\S+) # capture any non-space characters
        ; # ending in a semi-colon
        /x
      )
    {

```

Please note: this is no valid syntax for MP3tag.  
As MP3tag allows only a single line input (the UI elements have only a single line) I do not see how the code in MP3tag should benefit from it.

---

<div class="post-metadata">

**Author:** ![ragtag](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ragtag/32/13146_2.png) [@ragtag](https://community.mp3tag.de/u/ragtag)\
**Post date:** [May 26, 2023, 2:20pm UTC](https://community.mp3tag.de/t/perl-modifier-for-a-less-dense-regular-expression-syntax/61073/5 "2023-05-26T14:20:32Z")

</div>

@ohrenkino

Thank you for making the distinction clear.

---

<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:** [June 25, 2023, 2:21pm UTC](https://community.mp3tag.de/t/perl-modifier-for-a-less-dense-regular-expression-syntax/61073/6 "2023-06-25T14:21:08Z")

</div>

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