Lurker News

Comments (129) 40 threads

Earlier comments
geongeorgek#
I used to spend hours trying to craft the perfect expression for my scraping projects not realizing that I don't really know regex.

This tool is a cheat sheet that also explains the commonly used expressions so that you understand it.
- There is a visual representation of the regular expression (thanks to regexpr)
- The application shows matching strings which you can play around
- Expressions can be edited and these are instantly validated

StavrosK1 reply#
I love regex and have no trouble reading them, but still love this tool, great job. I especially like the railroad diagrams, for those cases where I brainfarted on a regex and it's doing something other than what I intended. Thanks for this.
geongeorgek1 reply#
I'm glad you like the tool <3 It will have a lot more content soon :)
chirss#
If you want some help swing by #regex on efnet, happy to help.
lfglopes1 reply#
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?

deadliftpro#
same, looking for an alternative to txt2re.
rubyn00bie1 reply#
Nice work on this!

Something subtle, but I quite loved the email regex is, IMHO, close to perfect: \S+@\S+\.\S+
Because the "perfect" one is just absurd, and no one realizes it's going to be so fucking absurd until they start getting support cases and then go read something like this: https://stackoverflow.com/a/201378/931209
> If you want to get fancy and pedantic, implement a complete state engine. A regular expression can only act as a rudimentary filter. The problem with regular expressions is that telling someone that their perfectly valid e-mail address is invalid (a false positive) because your regular expression can't handle it is just rude and impolite from the user's perspective.

p4lindromica#
Even this regexp has false positives.

The `ai` ccTLD ran their own mail server at the root, so an address like `a@ai` was a valid email address.
They serve a website at the tld root: http://ai./

Load more comments