```python
import re

def remove_whitespaces(text1):
  """
  Removes all whitespaces from the given string using regex.

  Args:
    text1: The input string.

  Returns:
    The string with all whitespaces removed.
  """
  # The pattern r'\s' matches any whitespace character (space, tab, newline, etc.).
  # re.sub replaces all occurrences of the pattern with an empty string.
  return re.sub(r'\s', '', text1)

```