Live data from Hacker News

Show HN: Regex Cheatsheet

ihateregex.io

31–40 of 135 posts

Re: Show HN: Regex Cheatsheet

#31
I used to use this site http://txt2re.com which is now off the grid, at the least since yesterday. :(

Unlike most regex helpers, in this one you would start with the text you want to filter/parse and then it would suggest you possible extractions.

Do you know any alternatives?

Re: Show HN: Regex Cheatsheet

#32
post #19

^[a-z0-9_-]{3,15}$ The username reference doesn't match 16 characters as claimed

I should match. the number 15 there means that repeat x up to 15 times. so 1+15=16. looks good to me

where does the extra 1 come from? a{2,5} means match 'a' two to five times

Re: Show HN: Regex Cheatsheet

#33
post #21

Nobody pointed it out, but there's also https://regexr.com/ It's how I learned regex years ago, and I still use it today to test/build more complex patterns.

Well, there is a whole list of useful regex links posted 5 months ago when someone posted url to RegExr.

Enjoy: https://news.ycombinator.com/item?id=20614847

Re: Show HN: Regex Cheatsheet

#36
post #34
post #21

Nobody pointed it out, but there's also https://regexr.com/ It's how I learned regex years ago, and I still use it today to test/build more complex patterns.

My go-to is https://regex101.com/

I use the same as a default. It's been a great help.

Re: Show HN: Regex Cheatsheet

#38
neat site! clicking an example opens up a playground with live update and explanation and railroad diagrams, similar to sites like regex101[1] and regulex[2]

one suggestion would be to mention clearly which tool/language is being used, regex has no unified standard.. based on "Cheatsheet adapted" message at the bottom, I think it is for JavaScript. I wrote a book on js regexp last year, and I have post for cheatsheet too [3]

[1] https://regex101.com/

[2] https://jex.im/regulex

[3] https://learnbyexample.github.io/cheatsheet/javascript/javas...

Re: Show HN: Regex Cheatsheet

#39
post #11

This is really cool! 2 points: 1. it fiddled with my back button which is a bit annoying 2. a better email sample is ^[^@]+@[^@]+\.[^@]+$ which removes the 2 ampersands problem.

Even that is wrong because you can have privately owned TLDs (I forget what they're technically called) like .google

So sundar.pichai@google is technically a valid address (whether .google has any MX records is another matter)

Regex shouldn't really be used for email addresses anyway because the only reliable way to authenticate an email address is to literally send an email to that address.

Post reply on HN