Hello I'm using ACL and I have trouble with REGEXP. I tried many ways but somehow it doesn't work.
The meta-field is a ACL-Textarea.
I need to search after searchword. After that word there may multiple whitespaces before there is either a comma, newline or end of string.
Here my code, please take a look at this line: $limiter = " *(\n|\,|$)"
;
...
// Preparation
$limiter = " *(\n|\,|$)";
$search_names = explode(' ', $_POST['gsdname']);
...
$search_language1 = '';
if($_POST['workingLanguage1'])
{
$search_language1 = array(
'key' => 'arbeitssprache',
'value' => trim($_POST['workingLanguage1']).$limiter,
'compare' => 'REGEXP'
);
}
...
// Build search arguments
$args = array(
'post_type' => 'page',
$parent_page_parameter => $parent_page_id,
'title_filter' => $search_names,
'meta_query' => array(
'relation' => 'AND',
$search_language1,
$search_language2,
$search_workingArea,
$district_filter
)
);
add_filter('posts_where', 'title_filter',10,2);
$query = new WP_Query( $args );
remove_filter('posts_where', 'title_filter',10);
...
Coma works fine, but the whitespace and end of string $ doesn't work. And I'm confused with whitespace since I expect to find something like "Search ," but it also find "SearchYaddaYadda,". Why? Whats wrong about " *"?
Best regards Floh