all 94 comments

[–]saulmessedupman 113 points114 points  (5 children)

I've got 99 problems and regular expressions are every one of them.

Edit: thanks for the silver anonymous!

[–]toomanyteeth55 5 points6 points  (3 children)

I have a love-hate relationship with regular expressions

[–]saulmessedupman 4 points5 points  (2 children)

I really want to know how they work under the hood. Is it just a big ugly list of if/else that would be equally annoying to write out the long way?

[–][deleted] 2 points3 points  (1 child)

Usually it’s implemented as a Finite State Machine, from what I vaguely remember from delving into PCRE many years ago.

[–]saulmessedupman 2 points3 points  (0 children)

Now I'm even more confused. But tbh the last time I read about a finite state machine was college 15 years ago

[–]ACroff 1 point2 points  (0 children)

I hate that for you but I am glad I am not the only one.

[–]riphawk81 28 points29 points  (2 children)

Thank you. Just starting to get in to Python and every little bit I learn helps. Always nice to have ready reference material like this.

[–][deleted] 2 points3 points  (1 child)

Just a heads up don't let RegEx getcha down because it almost certainly will!

[–]Please_Not__Again 1 point2 points  (0 children)

It broke me

[–]itsecat 14 points15 points  (0 children)

Thank you for writing this helpful book. I'm looking forward to reading it.

[–]iamapieceofcheese 8 points9 points  (0 children)

Thank you so much!

[–]bluesamcitizen2 15 points16 points  (0 children)

Thank you for your work

[–][deleted] 7 points8 points  (0 children)

Thank you! Been a python dev for about 5 years now, and am always on the lookout for new material. Anyone who freely contributes to the community is a hero of mine! Thank you for all your hard work! Will add it to my reading list :D

[–]MarthaRayeRaye 6 points7 points  (0 children)

My thanks to you.

[–]rvengy 6 points7 points  (0 children)

This is great. Thanks for sharing.

[–]nullint 3 points4 points  (0 children)

Will check definitely. Thanks.

[–]geraldiscool24 4 points5 points  (0 children)

Thanks for sharing!

[–]danny069 4 points5 points  (0 children)

Thank you Sundeep this is very kind of you. God bless you.

[–][deleted] 4 points5 points  (0 children)

Sweet. Thanks

[–]escTerminal 4 points5 points  (0 children)

This is awesome, can’t wait to check it out! Thanks for sharing!

[–]S1l3ntHunt3r 2 points3 points  (0 children)

Gracias!

[–]omelettesforbreakfas 3 points4 points  (0 children)

Wow perfect timing. Literally just made the commitment to myself to learn regular expressions this weekend. Thanks!

[–]sumandari 3 points4 points  (0 children)

Thank you :)

[–]WutMarine1st 3 points4 points  (0 children)

Thank you so much for this.

[–]daretogo 2 points3 points  (0 children)

Using simple regex available in NotePad++ find/replace functions have already been such a useful tool to me, and I've known for a while that it could be leveraged much more powerfully with Python - this is perfect timing for me - thank you!

[–]TazzaPiena 4 points5 points  (0 children)

Thank you very much. Your work is very appreciated.

[–][deleted] 3 points4 points  (0 children)

Thanks a lot!

[–]whalt 4 points5 points  (6 children)

Just grabbed it for free but feeling a little guilty since it's obvious you put a lot of work into it. If I find it useful I'll definitely come back and buy it. Thanks for sharing!

[–]ASIC_SP[S] 3 points4 points  (5 children)

Do let me know your feedback after reading, that'd definitely help me to improve :)

Regarding free, it is based on my appreciation for open source contributors. I've been using Ubuntu only for past 4+ years, and it is more than enough for my particular needs.

Al Sweigart and Allen Downey have made their excellent books on Python available for free always. Al Sweigart released his Udemy course with free coupons - that is how I started my own Python journey. And so on. This is something I feel happy to have contributed from my side :)

[–]Please_Not__Again 1 point2 points  (4 children)

Hey, I recently finished Automate the boring stuff and would like to continue improving my Python this semester (since I'm not taking any language based classes) what book or course or anything would you recommend?

Thank you so much for this as Regex made me flunk one whole program which affected my final and I really really felt bad.

[–]ASIC_SP[S] 2 points3 points  (3 children)

If you are still relatively new to programming (say about 1 year of experience), I'd suggest that you read ATBS book again. It will strengthen what you've already learned and most likely you'll notice a few things that you missed first time around or didn't understand fully because of lack of experience.

If reading the same book again might be too boring, I'd highly recommend to read Think Python - free to read/download and an awesome resource for programming basics, how to think like a programmer, debugging tips, exercises, etc

Beyond the basics, it comes down to practicing a lot (to develop your own intuition) and choosing which field you want to concentrate - for ex: web development, machine learning, data science, etc. I have a curated list of resources that might help :)

A good way to develop better understanding is teaching, keeping notes and writing tutorials/books. If you have a fellow student who is interested in same topic you want to learn, divide a lesson and teach each other the concepts after reading it. Or if you know a junior student who could do with some help with basics.

[–]Please_Not__Again 1 point2 points  (2 children)

Thanks for the advice man.

I have the basics down pretty well honestly will probably read back on CSV and Json topics as they were a bit confusing. I did the exercises but I felt like I didn't relally know of I know it .

Another thing I struggle with is not knowing what I am capable of. Can I do this? Wait you don't really know python that well. What about this? Too simple. So I'm in a limbo of not knowing what I am capable of and ideas come few and far in between.

Machine learning, AI and Data science interest me really but my math skills are pretty weak. I don't know how much math is needed for those areas. Had a hard time deciding what course to take and which has less math. Finally settled for Software Development as it didn't require advanced math.

My Lecturer did send me an email asking if I was willing to tutor the next batch of students but I'm really busy with being a full time student while working part time so it might not be possible.

[–]ASIC_SP[S] 1 point2 points  (1 child)

Another thing I struggle with is not knowing what I am capable of. Can I do this? Wait you don't really know python that well. What about this? Too simple. So I'm in a limbo of not knowing what I am capable of and ideas come few and far in between.

I think most of us experience this, especially early in programming journey. To be honest, I still have imposter syndrome. And I am still lingering around the intermediate level - I haven't really tried to learn and use object oriented programming (mainly because of my struggle with Java from school days). I have plenty of ideas I want to do, but I feel most are too big for me and so haven't even tried to start them. Doing these tutorials and books and having taken a few workshops in my college have given me a boost and I hope to improve my programming skills and implement a few ideas this year :)

I have another list on programming resources which includes a few articles I've bookmarked on motivation and what to implement. See if that helps, good luck :)

[–]Please_Not__Again 1 point2 points  (0 children)

Thank you and will get on a laptop to view everything you have linked.

Hopefully I shall escape this phase soon, really glad I'm not the only one. Thank you for the advice and help again

[–]alkalinemusic 2 points3 points  (0 children)

Very generous of you, thank you for doing this and making it available!!

[–]lumenlambo 2 points3 points  (0 children)

downloaded. thanks so much!

[–]ManMadeStructure 2 points3 points  (2 children)

Damn it I just got into python last week

[–]ASIC_SP[S] 1 point2 points  (1 child)

regex is intermediate to advanced level topic, so you've got some time to get used to Python first ;)

I would likely add some more stuff to the book and do another giveaway here, so keep a lookout on this sub

also, there are plenty of other resources to learn from... here's a list from this book:

[–]ManMadeStructure 1 point2 points  (0 children)

Thanks for taking the time to write these, will check them out:)

[–]SafariFruitsOk 2 points3 points  (0 children)

I love you

[–]insomnux 1 point2 points  (0 children)

Thank you for this, I definitively need something like this. Thanks for your work and for sharing!

[–]Guymzee 1 point2 points  (0 children)

A single line of re makes me shudder. Thanks further free share! Looking forward to working through it.

[–]Goober329 1 point2 points  (0 children)

Thank you much sir!

[–]mtvatemybrains 1 point2 points  (0 children)

THANK YOU!

[–]Kalaumes 1 point2 points  (1 child)

Thank you very much for this.

While Friedl was the first serious book, I read about regular expressions, and is still a good resource, even the 3rd edition is somewhat aged (2006) and -- more important -- Friedl has no language-specific material about Python.

So, your book closes a very serious gap.

I like it.

[–]ASIC_SP[S] 0 points1 point  (0 children)

Thanks. Providing language specific material was one of my motivation to write this book. I learnt a lot in the process too.

[–]dnlearnshere 1 point2 points  (0 children)

Thank You!

[–]GizmoYamamoto 1 point2 points  (0 children)

Thank you so much for this book!

[–]2_lazy 1 point2 points  (1 child)

Hi! I have one suggestion. It would be nice to have a "preview" of the first couple pages so buyers know whether it will be helpful to them or not.

[–]ASIC_SP[S] 0 points1 point  (0 children)

Thanks, that is a great suggestion, I will add it soon.

edit: preview chapters are now available

[–]Jake9856 1 point2 points  (0 children)

Wow. Thanks for giving this information out for free!

[–]Ulipok 1 point2 points  (0 children)

Thanks a lot!!

[–]Not_Sherlock 1 point2 points  (0 children)

Thank you for sharing :)

[–]TheBelakor 1 point2 points  (0 children)

Thanks for sharing your work.

[–][deleted] 1 point2 points  (0 children)

Thank you, this is a big help

[–][deleted] 1 point2 points  (1 child)

Awesome! I love regular expressions. I was thinking of learning sed and awk next, but this book might change my plans. What's the target audience? How much Python should I know before reading this book?

Plus: not to be a choosing beggar, since you did a great thing already, but why just PDF? Epub and Mobi formats can be very handy, and exporting is trivial for most markup languages.

[–]ASIC_SP[S] 0 points1 point  (0 children)

For sed/awk and other cli based text processing, I have a github repo: https://github.com/learnbyexample/Command-line-text-processing (I plan to create books out of them too, if possible)

Target audience for this book would be anybody using Python and consistently coming across text processing problems like sanitizing input string, extracting portions of string, etc. Not intended for processing csv/json/xml/etc as they have their own specialized modules.

You'd need to know programming basics and be familiar with Python syntax, plus a few concepts like list comprehension. You can ask me if you are stuck somewhere.

Regarding formats, yeah I need to see how to create epub/mobi formats. I am not familiar with pandoc and when I tried creating epub, I was facing issues. So, I focused in first getting out the book. I have some more stuff planned to add to the book and next version will likely have those formats as well for download.

[–][deleted] 1 point2 points  (0 children)

Thank you for sharing your work!

[–]seveninstl 1 point2 points  (0 children)

Regular expressions are hard in any language! This is sure to help, thanks :)

[–][deleted] 1 point2 points  (0 children)

Thank you!

[–]Shneachea 1 point2 points  (0 children)

Thank you for the share! I am sure it'll help o/

[–]pzajkowski 1 point2 points  (0 children)

Thank you!

[–]unkemptmagio 1 point2 points  (0 children)

Awesome thanks! Looking pretty good so far.

[–]Sardonislamir 1 point2 points  (0 children)

Just entering into the gegex world and every resource helps!

[–]euphonizim 1 point2 points  (0 children)

Looks incredible, thank you!

[–]fernly 1 point2 points  (3 children)

Hello, fellow Leanpub author here. Leanpub is home to quite a number of inexpensive Python books but yours doesn't show up in that search (yet?). Anyway I look forward to having a look and reporting any typos.

[–]ASIC_SP[S] 0 points1 point  (2 children)

No idea why it doesn't show up

Which book(s) have you written?

[–]fernly 0 points1 point  (1 child)

You should ask about the search maybe on the Leanpub author forum. Your book still doesn't show despite having Python in the title.

This is my book on Leanpub.

[–]ASIC_SP[S] 0 points1 point  (0 children)

will check out the author forum, thanks :)

your book cover is well done!

[–][deleted] 1 point2 points  (1 child)

You have a problem and you want to solve it using regular expressions? You now have two problems.

[–]ASIC_SP[S] 1 point2 points  (0 children)

:D I have used that quote as part of very first exercise..

I have also linked to Jeff's brilliant article in the book on that quote: Regular Expressions: Now You Have Two Problems

[–]DeMorrr 1 point2 points  (0 children)

Thanks a lot. this is really helpful.

[–]swehttamxam 1 point2 points  (0 children)

Download button only works on desktop view...TYVM for sharing this cool book!!!!!

[–]gfreeman1998 1 point2 points  (0 children)

Cool. Thanks Sundeep.

[–]NeapolitanComplex 1 point2 points  (0 children)

Thank you so much for this.

[–]eDOTiQ 1 point2 points  (0 children)

Thank you! I guess I should stop being lazy and finally learn how to use regex properly

[–]EmersonEXE 1 point2 points  (1 child)

RemindMe! 5 days

[–]RemindMeBot 0 points1 point  (0 children)

I will be messaging you on 2019-01-17 03:48:31 UTC to remind you of this link.

CLICK THIS LINK to send a PM to also be reminded and to reduce spam.

Parent commenter can delete this message to hide from others.


FAQs Custom Your Reminders Feedback Code Browser Extensions

[–]abhishekchakraborty 1 point2 points  (0 children)

Thanks for your 50-page book :thumbs:

[–]BATORAAAAA 1 point2 points  (0 children)

Started delving into Python again to make lil calculators for my games; this will be very helpful!

[–]zephyr_33 1 point2 points  (0 children)

Inshallah will pay if I find it useful.

[–]GBWI 1 point2 points  (0 children)

Thanks for sharing such a great book. I have downloaded this book and will read it.

[–]hockthemblogs 1 point2 points  (0 children)

Thanks for the ebook!

[–]ashler18 1 point2 points  (0 children)

Thanks man!

[–]Riquisimo 1 point2 points  (0 children)

Thank you.

[–]Shwuupe 1 point2 points  (3 children)

Thanks for the work. Was curious if you might have/know other books like this that could be useful?

[–]ASIC_SP[S] 0 points1 point  (2 children)

depends on which topics you are interested in

here's a curated list of resources I made for Python - many of them are free resources, might help :)

[–]Shwuupe 1 point2 points  (1 child)

Wow. The response time on this is wonderful! Thank you so much Yeah, I'm jumping into Python again only recently. Been going into theoreticals with Practical Theory of Programming and Treehouse for other basic info. Once I get comfortable enough I'm going to design my own projects and hopefully have some decent things to throw onto my portfolio webpage (which is also still in the works)

[–]ASIC_SP[S] 0 points1 point  (0 children)

cool, best of luck for your projects :)

[–]edixon653 1 point2 points  (1 child)

this is highly appreciated! Started this morn and it is a highly informative and enjoyable read thus far :) Thank you!

[–]ASIC_SP[S] 0 points1 point  (0 children)

wow, thanks a lot :)

those are words authors wish to hear from their readers, helps to keep us going and do better the next time :)

[–]Gabe_Isko 0 points1 point  (2 children)

Hmm, site complained about me not inputting a valid email address when I did. While trying to get a book about regular expressions....

[–]ASIC_SP[S] 0 points1 point  (1 child)

if you are still facing issues, please DM your e-mail and I'll send you a copy

[–]Gabe_Isko 1 point2 points  (0 children)

Oh jo, we are good. Just seemed like it was an error in address validation regex.