Skip to content

Commit f5ea38e

Browse files
committed
feat(email): add simplified email address format
1 parent aeca34d commit f5ea38e

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

src/dsl/matchers.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,8 @@ describe("Matcher", () => {
377377
describe("when given a valid Email address", () => {
378378
it("creates a valid matcher", () => {
379379
expect(email("hello@world.com")).to.be.an("object")
380+
expect(email("hello@world.com.au")).to.be.an("object")
381+
expect(email("hello@a.co")).to.be.an("object")
380382
expect(email()).to.be.an("object")
381383
})
382384
})

src/dsl/matchers.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ import MatcherError from "../errors/matcherError"
1010
// Note: The following regexes are Ruby formatted,
1111
// so attempting to parse as JS without modification is probably not going to work as intended!
1212
/* tslint:disable:max-line-length */
13-
export const EMAIL_FORMAT =
14-
"^[a-z0-9!#$%&'*+\\/=?^_‘{|}~-]+(?:\\.[a-z0-9!#$%&'*+\\/=?^_‘{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$"
13+
export const EMAIL_FORMAT = "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,}$"
1514
export const ISO8601_DATE_FORMAT =
1615
"^([\\+-]?\\d{4}(?!\\d{2}\\b))((-?)((0[1-9]|1[0-2])(\\3([12]\\d|0[1-9]|3[01]))?|W([0-4]\\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\\d|[12]\\d{2}|3([0-5]\\d|6[1-6])))?)$"
1716
export const ISO8601_DATETIME_FORMAT =

0 commit comments

Comments
 (0)