The project is hosted here: https://projects.lukehaas.me/regexhub
The patterns are contained in the file src/data/index.js
Each pattern requires the following details:
- name
- regex
- description
- tags
A collection of useful regex patterns
License: MIT License
The project is hosted here: https://projects.lukehaas.me/regexhub
The patterns are contained in the file src/data/index.js
Each pattern requires the following details:
I find I frequently need a regex for dollar amounts, for example: \d*(\.\d{1,4})?
Would this be something that would make sense to add?
Atm. it seems that you only do a check for https://. Maybe you should think about adding http too
What steps do I take to run this locally?
dont have time to submit pull req, but this regex checks for IP validity, can provide 1 IP addr or a range, ie
192.168.5.100-192.200.20.255
^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]).){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^.*-,{3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$
you can check it here
https://regex101.com/
Also for email, this regex is more encompassing
^[a-zA-Z0-9_.+-]@[a-zA-Z0-9_.+-].[a-z][a-z][a-z]
Steps to Reproduce :
22:33
Expected Result
The RegEx for 'Time in 24-hour format' should give minutes value in the output
Actual Result
The RegEx for 'Time in 24-hour format' does not give minutes value in the output
Hi there. That's cool idea. I think that you can use the @regexhq organization to get regexps.
Purpose behind RegexHQ is to learn, share and collect regular expressions - as much as possible.
it does not display single digit minutes in time it is because it is compulsary for 1st digit to be 0 to 5. if user enter minutes without 0 it does not work you can fix this by using this regex /^([01]?[0-9]|2[0-3]):[0-5]?[0-9]$/
It should allow the user to type in whatever he/she wants. Why? Because they might be using password generators and this regex:
/^[a-zA-Z0-9+_-]{6,18}$/
... is limiting them to use only a small subset of characters and that is not a good practice. I think it should also allow to type in longer text, instead of 18
, I would use for example 32
.
Steps to Reproduce :
<h1>Heading</h1>
(this is one of the valid tags as per W3 School site)Expected Result
The RegEx for HTML tag should match all the HTML tags
Actual Result
The RegEx for HTML tags does not match the HTML headings tags
Maybe is a feature, but for me should be generic so that it validates all "valid" dates.
It doesn't work if you try to validate: "01/01/2100"
HTML Tags
/^<([a-z1-6]+)([^<]+)*(?:>(.*)<\/\1>|\s+\/>)$/
Hex Value
/^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/
Hex HTML/CSS color value maybe, but 0xDEADBEAF
is a perfectly valid hex value.
Password
/^[a-zA-Z0-9+_-]{6,32}$/
Slowly we're moving the world to password phrases and everybody should be hashing their passwords. Then why the 32 char limit? And why, for Pete's sake, are we only allowing a-zA-Z0-9+_-
and nothing else? *cries* (see also)
/^([a-z0-9+_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,24})$/
Yeah. Just. No. Another famous answer
Positive number
/^\d*\.?\d+$/
We don't all live in the US/UK. (1,234.56
v.s. 1.234,56
)
Phonenumber
/^\+?[\d\s]{3,}$/
+123 is a valid phonenumber? Where? Phonenumbers are notoriously hard to validate (hence libphonenumber for example).
Date in format dd/mm/yyyy
/^(0?[1-9]|[12][0-9]|3[01])([ \/\-])(0?[1-9]|1[012])\2(19[0-9][0-9]|20[0-9][0-9])$/
Failed the very first 'edge case' I could come up with: 30/02/2016 but also 1852 or 2150 fail... ( as noted elsewhere).
Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. - Jamie Zawinski
Hi Luke,
Nice project, I guess you already know regex101.com, so maybe sharing your regexes in its library would be cool, also allowing people to go directo to their editor/tester.
Here's one of mine: https://regex101.com/r/It4QGm/1
For currency parsing.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.