π¬ A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots π
TypeScript browser-extensionchrome-extensiondocumentationfirefox-extensionguide-generatorlocal-firstmanifest-v3privacy-firstproductivityreactscreenshotstep-by-step-guidetutorialtypescriptworkflowwxt
fix(blur): match uk phone numbers and stop matching reference numbers
Luis Ortiz223ae61b8e63
diff --git a/src/core/blur/__tests__/regexes.test.ts b/src/core/blur/__tests__/regexes.test.tsindex 95333f3..79f6cc6 100644--- a/src/core/blur/__tests__/regexes.test.ts+++ b/src/core/blur/__tests__/regexes.test.ts@@ -79,6 +79,20 @@ describe('phone regex', () => {it('matches numbers without separators', () => {expect('5551234567').toMatch(regex());});++ it('matches UK numbers', () => {+ expect('07700 900461').toMatch(regex());+ expect('+44 7700 900461').toMatch(regex());+ expect('0113 496 0122').toMatch(regex());+ expect('07700900461').toMatch(regex());+ });++ it('does not match plain reference numbers, quantities or dates', () => {+ expect('12345678').not.toMatch(regex());+ expect('1234 5678').not.toMatch(regex());+ expect('Order 2024 20260401').not.toMatch(regex());+ expect('Qty 500 1000').not.toMatch(regex());+ });});describe('SSN regex', () => {diff --git a/src/core/blur/regexes.ts b/src/core/blur/regexes.tsindex 65455d8..fb4e7fc 100644--- a/src/core/blur/regexes.ts+++ b/src/core/blur/regexes.ts@@ -4,7 +4,8 @@ export const PRESET_REGEXES: Record<PresetKey, RegExp> = {email: /\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/gi,ssn: /\b\d{3}-?\d{2}-?\d{4}\b/g,creditCard: /\b(?:\d[ -]*?){13,19}\b/g,- phone: /(?:\+?\d{1,3}[\s.-]?)?(?:\(?\d{2,4}\)?[\s.-]?)?\d{3,4}[\s.-]?\d{4}\b/g,+ phone:+ /(?:\+\d{1,3}[\s.-]?\d{2,5}[\s.-]?\d{3,4}[\s.-]?\d{3,4}|\b0\d{1,4}[\s.-]?\d{3,4}[\s.-]?\d{3,4}|\(\d{3}\)[\s.-]?\d{3}[\s.-]?\d{4}|\b\d{3}[\s.-]\d{3}[\s.-]\d{4}|\b\d{10,11})\b/g,ipAddress: /\b(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\b/g,macAddress: /\b[0-9A-F]{2}(?:[:-][0-9A-F]{2}){5}\b/gi,};