Switching to PHP 8.0 throws an error warning in preg_replace


Right here is my code, in the features documents.

 feature tssupp_search_exact_match( $view_args, $view_settings, $view_id) {

if (999 == $view_id) {

if (! isset( $view_args['s'])) {
// no search term, bork the question
$ view_args['post__in']='0';.
}

// search term exists, so ...
// 1. strip areas to compel a solitary search term.
$ search = preg_replace('/ s+/', ", $view_args['s'] );.
$ view_args['s'] = $search;.

// 2. change SQL in which provision to utilize LIKE 'search' not LIKE '% search%'.
add_filter( 'posts_search', 'tssupp_modify_sql_where', 1000, 2 );.

}

return $view_args;.
}
add_filter( 'wpv_filter_query', 'tssupp_search_exact_match', 101, 3 );

As well as when I change from PHP 7.4 to PHP 8.0 I obtain this message.

Caution: Undefined variety trick “s” in/ home/customer/www/ mysite.com/public_html/wp-content/themes/my-theme/functions.php on line 83

Line 83 is: $search = preg_replace(‘/ s+/’, “, $view_args[‘s’] );

Any type of suggestions on exactly how to remedy?

I’m utilizing WordPress 6.02