in reply to Re^2: Best Practice: Order of regex modifiers?
in thread Best Practice: Order of regex modifiers?

Hi Rolf,

Well all modifiers change the behaviour of a regex, don't you think?

Well yes, but: some change how the pattern of the regex is treated, like /xmsialud, whereas some change how the regex operator, like m//, behaves. For example, the return values of m// are quite different from those of m//g, and /g doesn't affect how the pattern is treated.

Regards,
-- Hauke D

Replies are listed 'Best First'.
Re^4: Best Practice: Order of regex modifiers?
by LanX (Saint) on Feb 02, 2017 at 17:27 UTC
    Hi Hauke,

    I agree that modifiers like /gcr are fundamentally changing the command.

    That's why in other languages like JS one really needs different commands to achieve the same results.

    There is no easy answer how to prioritize the order...

    ...if possible commands called sr/// or mg// would IMHO be the best choice.

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!