Compare titles with another title

A function which compares a title with a post to a list of titles.

$current_title = get_the_title();
$titles = new WP_Query( array( 'post_type' => 'products', 'posts_per_page' => -1 ) );
if( $titles->have_posts() ) {
   while( $titles->have_posts() ) {
      $titles->the_post();
      $title = get_the_title();
      if( preg_match('/' . $title . '/i', $current_title, $matched ) ) {
         $match = $matched[0];
      }
   }
}