Quoth demerphq@gmail.com (demerphq): > On 2 August 2010 00:54, karl williamson <public@khwilliamson.com> wrote: > > > > I think I like your idea. �Let me make sure I understand. �A tilde > > immediately following '(?' means that the clustering group is to have the > > default modifiers, subject to any flags that come after it. �Thus (?~:abc) > > means all default flags. �(?~x:abc) means the defaults except use the x > > modifier, and (?~-x:abc) means the defaults without the x modifier, which is > > a somewhat more complicated way of writing the equivalent (?~:abc). > > > > regex stringification could change to output just the non-defaults, or we > > could leave them as-is, and just add the tilde. �Since we would already be > > breaking compatibility, I would think we might as well remove them. > > > > A tilde is not the ideal choice because it can easily be confused with a > > minus sign. �I don't know if there are other characters that could be used > > instead. > > Can you paint a picture for me as to how you think this is useful and > would work in practice? What problem it solves? > > Right now I would vote against this idea in terms of minimal benefit > for long term costs, so maybe I don't understand the point properly. You may be right. > Top of my mind questions: > > How do you define "the default modifiers"? Assume we have them, and > they end up user configurable, what happens when a regex is compiled > in one context and the interpolated in another? They can't be user-configurable, at least not as far as (?~:) is concerned. If there is some pragma that sets a 'default' set of modifiers, then (?~:) must always be with respect to the 'default default'. > What is the difference between /(?~i:foo)/ and /(?i)foo/ Nothing. However, "FOO" !~ /(?~s:foo)/i but "FOO" =~ /(?s:foo)/i BenThread Previous | Thread Next