Skip to content

0.41.0 - Added support for modifier 'n'

Compare
Choose a tag to compare
@danon danon released this 04 Dec 13:54
· 126 commits to master since this release

😎 T-Regx The Dinosaur is really proud to announce its release 0.41.0!

We've been working our fingers to the bone before official release of PHP 8.2, and with it comes the new and shiny /n modifier - "no auto capture". Some of us have been waiting for a long time, and in T-Regx we're not discriminating, and each PHP version should work the same. Because of that, we're backporting /n modifier to every PHP version supported. So if you're using T-Regx on PHP as old as 7.1, you are free to use /n in Pattern and PcrePattern to its fullest. It's completely supported. That feature is available as of version 0.41.0.

The modifier n can be used on each PHP version (since T-Regx 0.41.0) seamlessly. That means, any usage of modifier n in any part of the library (including the regular expression itself) works out of the box, as if the library was running on PHP 8.2.

The detailed list of changes is in ChangeLog.md.

  • Features
    • Since 0.41.0 T-Regx officially supports PHP 8.2.
    • Added full support for n modifier for every supported PHP version: 7.1 - 8.2
      • Despite modifier /n being only valid in vanilla regexp in PHP only since 8.2,
        modifier /n is fully supported in T-Regx in each PHP version.

      • Added full support for n modifier in Pattern

        • Pattern::of($pattern, 'n') is now accepted
        • Pattern::inject($pattern, $figures, 'n') is now accepted
        • Pattern::template($pattern, 'n') is now accepted
        • Pattern::builder($pattern, 'n') is now accepted
        • Pattern::literal($text, 'n') is now accepted
        • Pattern::alteration($texts, 'n') is now accepted
        • Pattern::mask($mask, $keywords, 'n') is now accepted
        • Pattern::list() now accepts patterns with n modifier
      • Added full support for n modifier in PcrePattern

        • PcrePattern::of("/$pattern/n", ) is now accepted
        • PcrePattern::inject("/$pattern/n", $figures) is now accepted
        • PcrePattern::template("/$pattern/n") is now accepted
        • PcrePattern::builder("/$pattern/n") is now accepted
    • Added public modifier constant to Pattern.
      • Added Pattern::NO_AUTOCAPTURE

        From now on, patterns can be constructed with such constants, for example:

        Pattern::of('^(foo)$', Pattern::NO_AUTOCAPTURE)

        String literal modifiers continue to work as before

        Pattern::of('^(foo)$', 'n');

The detailed list of changes is in ChangeLog.md.

Rawrrrrrrr!