testCafe .switchToWindow() method – how to switch to new window using only part of the url hostname (or title)

I would like to switch to new window using just part of the url hostname.
For example instead

  • switchToWindow(w => w.url.host === ‘testcafe.io’)

I would like to use sth like:

  • (w => w.url.host === /.testcafe/.) //regex
  • (w => w.url.host.includes(‘testcafe’))

These 2 above don’t work. Are there any other possibilities?