Repository: sweetalert2/sweetalert2 (JavaScript)

Issue:
Input Types - Email
### Current behavior

When create an alert with an input type of "email", it marks a valid email as invalid.
Example: jim.o'brien@domain.com
Error: Invalid email address

### Expected behavior

According to https://en.wikipedia.org/wiki/Email_address#Syntax and https://datatracker.ietf.org/doc/html/rfc5322#section-3.4.1 - That example email address is valid. You are allowed to have apostrophe's in your email address like that.

### Live demo !!! THIS FIELD IS REQUIRED !!!

The live demo: https://codepen.io/David-Ellsworth/pen/qBwBEQB
Type in "whatever.o'test@domain.com" or "jim.o'brien@domain.com"


Discussion:
https://github.com/sweetalert2/sweetalert2/blob/dcf568dd209a96b7761ae753c97c5f2d855a31ce/src/utils/defaultInputValidators.js#L7-L8

this shouldn't be changed without a semver major release though in my opinion since it is technically a breaking change
Hello @Speedy059, your request seems to be correct:

![CleanShot 2024-02-29 at 09 40 43@2x](https://github.com/sweetalert2/sweetalert2/assets/6059356/3eb40f06-e103-4e84-8674-16c8a3e85481)

I'd consider this as a bug-fix though, cc @zenflow 
:tada: This issue has been resolved in version 11.10.6 :tada:

The release is available on:
- [npm package (@latest dist-tag)](https://www.npmjs.com/package/sweetalert2/v/11.10.6)
- [GitHub release](https://github.com/sweetalert2/sweetalert2/releases/tag/v11.10.6)

Your **[semantic-release](https://github.com/semantic-release/semantic-release)** bot :package::rocket:



Patch:
diff --git a/src/utils/defaultInputValidators.js b/src/utils/defaultInputValidators.js
index 47b184368..b319c2352 100644
--- a/src/utils/defaultInputValidators.js
+++ b/src/utils/defaultInputValidators.js
@@ -5,7 +5,7 @@ export default {
    * @returns {Promise<string | void>}
    */
   email: (string, validationMessage) => {
-    return /^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]{2,24}$/.test(string)
+    return /^[a-zA-Z0-9.+_'-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]+$/.test(string)
       ? Promise.resolve()
       : Promise.resolve(validationMessage || 'Invalid email address')
   },


Test patch:
diff --git a/cypress/e2e/inputs.cy.js b/cypress/e2e/inputs.cy.js
index a7cc2c943..079295ccf 100644
--- a/cypress/e2e/inputs.cy.js
+++ b/cypress/e2e/inputs.cy.js
@@ -585,20 +585,44 @@ describe('Validation', () => {
     }, TIMEOUT)
   })
 
+  it('default email validator: test@example.com', (done) => {
+    defaultInputValidators.email('test@example.com').then((data) => {
+      expect(data).be.undefined
+      done()
+    })
+  })
+
+  it(`default email validator: o'test@example.com`, (done) => {
+    defaultInputValidators.email(`o'test@example.com`).then((data) => {
+      expect(data).be.undefined
+      done()
+    })
+  })
+
+  it(`default email validator: invalid email`, (done) => {
+    defaultInputValidators.email(`invalid email@example.com`).then((data) => {
+      expect(data).to.equal('Invalid email address')
+      done()
+    })
+  })
+
   it('default URL validator: https://google.com', (done) => {
-    defaultInputValidators.url('https://google.com').then(() => {
+    defaultInputValidators.url('https://google.com').then((data) => {
+      expect(data).be.undefined
       done()
     })
   })
 
   it('default URL validator: http://g.co', (done) => {
-    defaultInputValidators.url('http://g.co').then(() => {
+    defaultInputValidators.url('http://g.co').then((data) => {
+      expect(data).be.undefined
       done()
     })
   })
 
   it('default URL validator: http://foo.localhost/', (done) => {
-    defaultInputValidators.url('http://foo.localhost/').then(() => {
+    defaultInputValidators.url('http://foo.localhost/').then((data) => {
+      expect(data).be.undefined
       done()
     })
   })