Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
pragmatic-email-regex
Advanced tools
I am not a specialist when it comes to this subject. Just a pragmatic programmer who wants to help.
After building a whole lot of different web applications, I often came across cases where users enter all kinds of weird email addresses in my forms, sometimes even using discount coupons thinking that's what they had to do. This library is by no means a perfect source of truth when it comes to email validation, and it's not trying to be. People who want to nitpick about the exact specs and all the gazillion theoretical possibilities of the correct email string format are gonna be right when they say my library is not perfect. I'm not saying it is, I'm just sayin it's a solid, pragmatic, effective way to filter out most of the cases and hint users about their weird ass looking emails before they submit something that is not going to work either by mistake or simply to be annoying.
Plus it gave me a small pet project to test out github actions to automatically publish an npm package when pushing or merging to master...
I built this regular expression from inspirations on the web and by cross-checking with some of the big tech websites to see if it made sense when trying to filter out weird email addresses.
$ yarn add pragmatic-email-regex
or
$ npm i pragmatic-email-regex
// I recommend importing it with that name cause it makes more sense in the code.
import isValidEmail from 'pragmatic-email-regex';
// Return value is true or false depending on the string shape, that's it.
isValidEmail('email@right.here'); // true
FAQs
A simple, pragmatic email regex validator.
The npm package pragmatic-email-regex receives a total of 4 weekly downloads. As such, pragmatic-email-regex popularity was classified as not popular.
We found that pragmatic-email-regex demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.