in reply to Re^2: Reverse engineering regular expressions
in thread Reverse engineering regular expressions

This is a duplicate of my answer to Parse::RandGen::Regexp

As the qr// method runs in interpolative context one can do

use strict; my $match='test'; my $regex_match=qr/$match/i; my $test_value='This is a Test'; print 'It matches' if $test_value=~m/$regex_match/;

CountZero

"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law