in reply to Regex: What does ?k: mean?

See the documentation of Regexp::Common, where ?k: is documented under "adding new regular expressions". It seems to be internally used by Regexp::Common to implement the -keep feature.

Replies are listed 'Best First'.
Re^2: Regex: What does ?k: mean?
by haukex (Archbishop) on Feb 24, 2017 at 15:40 UTC

    For the curious (like me), the specific code that implements this appears to be:

    if (exists $flags{-keep}) { $pat =~ s/\Q(?k:/(/g; } else { $pat =~ s/\Q(?k:/(?:/g; }

    Update: Added link

Re^2: Regex: What does ?k: mean?
by hoppfrosch (Scribe) on Feb 24, 2017 at 08:16 UTC
    Thanks! I haven't seen the wood for the trees - and thought it's an undocumented regex feature ...