XF 2.0 finder with REGEXP inxenforo 2

Paul R

Active member
i try
Code:
$Finder->where('myfield', 'REGEXP', $n);
but this show error
[B]InvalidArgumentException:[/B] Operator REGEXP is not valid

Code:
switch ($operator)
        {
            case '=':
            case '<>':
            case '!=':
            case '>':
            case '>=':
            case '<':
            case '<=':
            case 'LIKE':
            case 'NOT LIKE':
            case 'BETWEEN':
                break;

            default:
                throw new \InvalidArgumentException("Operator $operator is not valid");
        }
how to use REGEXP with xenforo 2 finder system
 
Last edited:
You'll probably run into an error because you're missing a space between 'REGEXP' and the actual regexpression, but other than that, it should be fine. If you use double quotes, you can always write variables inside the string instead of concatenating, so you could write "myfield REGEXP $n" or if you want to make use of more complex stuff like properties, wrap it in curly brackets like "myfield REGEXP {$n->someProp}"
 
Back
Top Bottom