mirror of
https://github.com/parsecsv/parsecsv-for-php.git
synced 2026-02-19 00:36:38 +00:00
Merge pull request #180 from parsecsv/more-conditions-bu
Bugfix for verbal conditions
This commit is contained in:
14
src/Csv.php
14
src/Csv.php
@@ -1054,8 +1054,20 @@ class Csv {
|
||||
|
||||
if (preg_match('/^(.+) (' . $operators_regex . ') (.+)$/i', trim($condition), $capture)) {
|
||||
$field = $capture[1];
|
||||
$op = $capture[2];
|
||||
$op = strtolower($capture[2]);
|
||||
$value = $capture[3];
|
||||
if ($op == 'equals' && preg_match('/^(.+) is (less|greater) than or$/i', $field, $m)) {
|
||||
$field = $m[1];
|
||||
$op = $m[2] == 'less' ? '<=' : '>=';
|
||||
}
|
||||
if ($op == 'is' && preg_match('/^(less|greater) than (.+)$/i', $value, $m)) {
|
||||
$value = $m[2];
|
||||
$op = $m[1] == 'less' ? '<' : '>';
|
||||
}
|
||||
if ($op == 'is' && preg_match('/^not (.+)$/i', $value, $m)) {
|
||||
$value = $m[1];
|
||||
$op = '!=';
|
||||
}
|
||||
|
||||
if (preg_match('/^([\'"])(.*)([\'"])$/', $value, $capture) && $capture[1] == $capture[3]) {
|
||||
$value = strtr($capture[2], array(
|
||||
|
||||
Reference in New Issue
Block a user