in reply to Re^2: Style question: regex versus string builtin function
in thread Style question: regex versus string builtin function
A \Q does not "fill" an empty regex.
use Test::More 'tests' => 5; ok( 'foo' =~ //, 'empty regex matches' ); ok( 'foo' =~ /foo/, '/foo/ matches' ); ok( !('bar' =~ //), 'repeated match of foo' ); ok( !('bar' =~ /\Q/), 'repeated match with \\Q' ); my $empty = ''; ok( !('bar' =~ /\Q$empty/), 'interpolated empty string same as \\Q' );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Style question: regex versus string builtin function
by throop (Chaplain) on Oct 02, 2007 at 15:24 UTC | |
by kyle (Abbot) on Oct 02, 2007 at 15:41 UTC |