Every developer who has written a Playwright test for OTP verification has written this line:

const otp = email.body.match(/\b\d{6}\b/)?.[0];

Enter fullscreen mode

Exit fullscreen mode

It works. Until it doesn't.