Git Product home page Git Product logo

regexhub's Introduction

Regex Hub

The project is hosted here: https://projects.lukehaas.me/regexhub

Adding a new pattern

The patterns are contained in the file src/data/index.js

Each pattern requires the following details:

  • name
  • regex
  • description
  • tags

License

MIT License

Browser testing via lambda test

regexhub's People

Contributors

csobol avatar davidjbradshaw avatar dependabot[bot] avatar domtalbot avatar finkregh avatar focusaurus avatar jdhoek avatar jekku avatar kelvins avatar lukehaas avatar maanooak avatar nrdobie avatar otherpirate avatar pchaganti avatar ranudwis avatar robinbastiaan avatar ryanml avatar shobute avatar stryju avatar uzitech avatar zmax avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

regexhub's Issues

Integrate with RegexHQ

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.

I'm sorry, but there's loads of issues...

HTML Tags
/^<([a-z1-6]+)([^<]+)*(?:>(.*)<\/\1>|\s+\/>)$/

Famous answer

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)

Email
/^([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

Regex for IP Range

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]

The RegEx for 'Time in 24-hour format' does not give minutes value in the output

Steps to Reproduce :

  • Go to RegEx Site
  • Go to 'Time in 24-hour format' section and enter the test string as : 22:33
  • Observe that the output returned is : 22
  • The RegEx can be : /^([01]?[0-9]|2[0-3]):([0-5][0-9])$/ in order to give the minutes value in the output

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
output_without_min_value

Time in 24-hour format

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]$/

Password regex limitations

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.

The RegEx for HTML tags does not match the HTML Headings tags

Steps to Reproduce :

  • Go to RegEx Site
  • Go to HTML tags section and enter the test string as, HTML Heading tag : <h1>Heading</h1> (this is one of the valid tags as per W3 School site)
  • Observe that the output returned is null
  • The RegEx should be : /^<([a-z][1-6]+)([^<]+)(?:>(.)</\1>|\s+/>)$/ in order to match the HTML Headings tag

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.