odbdux has asked for the wisdom of the Perl Monks concerning the following question:
The program prints out NO MATCH#!/usr/bin/perl # use strict; use warnings; my $str = "abc12xdef34xghi56"; my $regexp ="qr/def/m"; if ($str =~ $regexp) { print "MATCHED\n"; } else { print "NO MATCH\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using variable in regular expression
by 1nickt (Canon) on Aug 08, 2019 at 03:58 UTC | |
by soonix (Chancellor) on Aug 08, 2019 at 08:56 UTC | |
| |
|
Re: Using variable in regular expression
by atcroft (Abbot) on Aug 08, 2019 at 04:05 UTC | |
|
Re: Using variable in regular expression
by odbdux (Initiate) on Aug 08, 2019 at 04:00 UTC |