in reply to Best Practice: Order of regex modifiers?
Hi Rolf,
Most regexes I write only have a few modifiers, so it's hard to get confused no matter what order they are in, and in those cases I don't see order as a problem. Although I don't have a strong opinion on this, if I did have to settle on a standard, I might consider the order that Perl uses when regexes are stringified, e.g.
$ perl -wMstrict -le 'print qr/abc/msixpoun' (?upmsixn:abc)
Although unfortunately, it seems this order doesn't match with the documentation, qr/STRING/msixpodualn, which is another possible ordering...
Update: Also, I often place those modifiers that change the behavior of the regex, like /gc, first, so they're immediately obvious.
Regards,
-- Hauke D
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Best Practice: Order of regex modifiers?
by LanX (Saint) on Feb 01, 2017 at 15:35 UTC | |
by haukex (Archbishop) on Feb 01, 2017 at 15:46 UTC | |
by LanX (Saint) on Feb 02, 2017 at 17:27 UTC |