http://www.perlmonks.org?node_id=1208739


in reply to Re^2: creating qr from existing regex
in thread creating qr from existing regex

Maybe use split

my $string = '/.*uba$/i'; my @f = split '/',$string; my $qr = ($f[-1] eq 'i') ? qr/$f[1]/i : qr/$f[1]/; my $cursor = $collection->query( { name=> $qr });
poj