PERL-modifier for a less dense regular expression syntax

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:


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.

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?

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.

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.

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

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.


Thank you for making the distinction clear.

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