Entity Query using conditions that ignore special characters
Drupal does not supply a solution to your problem out of the box.
However you can create a list of all the permutations and create a condition for each of them.



Code snippet

$searchterm = 'test-1_2 3';

$query = \Drupal::entityQuery('node')
  -&gt;condition('status', NODE_PUBLISHED);

// permutation generator function.
$permutations = function($source_term) {
  $result = [$source_term];
  $unprocessed_terms = [$source_term];
  $regex = '/[\W_]/'; // Selects all the non-alphanumeric characters and _

  while (!empty($unprocessed_terms)) {
    $unprocessed_term = array_pop($unprocessed_terms);
    $matches = [[]];

    // By using PREG_OFFSET_CAPTURE we get the position of the match.
    preg_match_all($regex, $unprocessed_term, $matches, PREG_OFFSET_CAPTURE);
    foreach($matches[0] as list($match, $pos)) {
      $result[] = $unprocessed_terms[] = substr_replace($unprocessed_term, '', $pos, 1);
    }
  }

  // the above algorithm will create duplicates.
  return array_unique($result);
};

// Create an OR condition group that contains a 
// condition for each permutation term.
$query-&gt;condition($or = $query-&gt;orConditionGroup());
foreach ($permutations($searchterm) as $term) {
  $or-&gt;condition('body', $term, 'CONTAINS');
}

$nids = $query-&gt;execute();