Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I need to be able to test against a regular expression stored in a variable...#!/usr/bin/perl $dataline = "This is a line of data ISOLATION"; $regex = "m/ISOLATION/"; if ($dataline ~= $regex) { print "Found a match!\n"; } else { print "No match!\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex from a variable...
by Masem (Monsignor) on Jun 15, 2001 at 23:52 UTC | |
by Anonymous Monk on Jun 16, 2001 at 00:02 UTC | |
|
Re: Regex from a variable...
by nysus (Parson) on Jun 15, 2001 at 23:49 UTC | |
|
Re: Regex from a variable...
by John M. Dlugosz (Monsignor) on Jun 16, 2001 at 01:20 UTC | |
by Anonymous Monk on Jun 18, 2001 at 22:28 UTC | |
|
Re: Regex from a variable...
by I0 (Priest) on Jun 15, 2001 at 23:52 UTC |