in reply to save regex in a file?
$regexNum = 0; $regexFile = "regex.txt"; $string = "alphabet is abc...\n"; print "Content-type: text/html\n\n"; if ($regexNum gt 0) { open FILE, $regexFile or die "Cannot open $regexFile file for read + :$!"; do { $re = <FILE> } until $. == $regexNum || eof; close(FILE); chomp($re); if ($string =~ m/$re/) { print "Matched this pattern - $re."; } else { print "This pattern - $re - not matched."; } } else { print "Regex not selected"; }
|
|---|