Skip to content

Commit 4763103

Browse files
committed
Update README.md
1 parent 58dbbde commit 4763103

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,27 @@ console.log(isEmpty(obj)); // true
217217

218218
**⚝ [Try this example on CodeSandbox](https://codesandbox.io/s/js-cp-isempty-b7n04b?file=/src/index.js)**
219219

220+
<div align="right">
221+
<b><a href="#">↥ back to top</a></b>
222+
</div>
223+
220224
## Q. ***JavaScript Regular Expression to validate Email***
221225

222226
```javascript
223-
var pattern = /^\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}$/;
227+
function validateEmail(email) {
228+
const re = /\S+@\S+\.\S+/;
229+
return re.test(email);
230+
}
231+
232+
console.log(validateEmail("pradeep.vwa@gmail.com")); // true
224233
```
225234

235+
**&#9885; [Try this example on CodeSandbox](https://codesandbox.io/s/js-cp-validateemail-wfopym?file=/src/index.js)**
236+
237+
<div align="right">
238+
<b><a href="#">↥ back to top</a></b>
239+
</div>
240+
226241
## Q. ***Use RegEx to test password strength in JavaScript?***
227242

228243
```javascript

0 commit comments

Comments
 (0)