[web] refactor device-ID-regex-related code
Summary: In response to comments on D4868 I refactored code ralated to device ID regex
Test Plan: Run yarn test on web
Reviewers: tomek, ashoat
Reviewed By: tomek, ashoat
Subscribers: atul, abosh
Differential Revision: https://phab.comm.dev/D4883