/usr/lib/interchange/code/OrderCheck/regex.oc is in interchange 5.7.7-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | # Copyright 2005-2007 Interchange Development Group and others
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. See the LICENSE file for details.
#
# $Id: regex.oc,v 1.3 2007-03-30 23:40:48 pajamian Exp $
CodeDef regex OrderCheck 1
CodeDef regex Description Regular expression match
CodeDef regex Routine <<EOR
sub {
my($ref, $name, $value, $code) = @_;
my $message;
$code =~ s/\\/\\\\/g;
my @code = Text::ParseWords::shellwords($code);
if($code =~ /(["']).+?\1$/) {
$message = pop(@code);
}
for(@code) {
my $negate;
s/^!\s*// and $negate = 1;
my $op = $negate ? "!~" : '=~';
my $regex = qr($_);
my $status;
if($negate) {
$status = ($value !~ $regex);
}
else {
$status = ($value =~ $regex);
}
if(! $status) {
$message = errmsg(
"failed pattern - %s",
"'$value' $op $_"
) if ! $message;
return ( 0, $name, $message);
}
}
return (1, $name, '');
}
EOR
|