#!/usr/bin/perl # notnextchar.pl - benchmark "capture before first b" regular expressions use 5.36.0; use Benchmark 'cmpthese'; my $s = ( 'a' x 9999 ) . 'but not these bytes'; cmpthese -5, { dotplus => sub { $s =~ /^(.+)b/ }, dotplqu => sub { $s =~ /^(.+?)b/ }, notnext => sub { $s =~ /^([^b]+)/ }, }