The parameter file (following) uses the first character to specify what operation (search or exception) the user wants to perform. The regexp runs from column 2 to the end of the line. What I want to do is use delimiters and modifiers included in the parameter file:/coWs/i
This works when delimiters are not included in the parameter file, but is very limited and flakey.+/six/i -/were/
Here is some of the code:+[Ss][Ii][Xx]
# Process Global Exceptions first foreach $except (@$glob_except) { $cexcept = substr($except, 1); $targf{$tkey} = "1:0" if ($tkey =~ /$cexcept/); # EXPANDS VARIABL +E HERE ### I would like the delimeters to be contained in the variable: ...( +$tkey =~ $cexcept); } elsif ($ttype eq '+') { if ($tkey =~ /$ttext/) { ; # EXPANDS VARIABLE HERE $targf{$tkey} = "3:$err_rtn"; $found = 1; } } elsif ($ttype eq '-' && substr($targf{$tkey},0,1) == 3) { if ($tkey =~ /$ttext/) {; # EXPANDS VARIABLE HERE $targf{$tkey} = "2:0"; $found = 0; } } else { ### ETCETERA ### THIS IS HOW THE HASH CONTAINING THE MATCH STRING IS LOADED elsif ($line_header eq '!') { ## Optional # Spec a global exception that affects all lines # interpolation takes place. unless ($trans_state == 2) {die "ERR: Global exception out of sequence";} push (@$glob_except, $line); # <= LOADING THE VARIABLE FROM + FILE # Trans state stays at 2 until set to 3 in subsequent logic
In reply to How do pack a regular expression in a variable? by pppaulll
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |