Hacker News new | past | comments | ask | show | jobs | submit login

Sincere question - is it worth investing time into reading a 500 odd page book for something that I might not use that frequently in my career? From my experience, I've seen that I can get away by just Googling or just experimenting whenever I'm stuck on a regex.



Absolutely.

The book doesn't just teach you regex, but the why, how AND the dialects. It gives you an overview over different tools and programming languages and their regex-related functions and methods.

On top, it contains a ton of examples, is very well written (considering the insanely dry and difficult to typeset subject :) and is very polished (I think it's in the 3rd edition by now..)

If you just google or experiment on regex, you usally get bad regex, badly crafted regex, brittle regex and make every single mistake the book prevents you from doing.

It's really one of the most worthwhile books of reading through - it's also an excellent handbook to look things up.

Remember that a lot of commandline tools take in regex too - grep, sed, awk, you name it - it's not just for use in programming languages.

Your favorite editor has regex too.

I simple don't know how people can live without; I'm using regex practically every day.

P.S.: And _after_ reading the book, you will understand why people yell at you when you parse HTML with regex but you will know how to do it anyways and at least not completely badly. ;)

P.P.S: And here's the canonical post to BUT OF COURSE you can parse HTML with regex from stackoverflow.. :) http://stackoverflow.com/questions/4231382/regular-expressio...


Well, maybe not an entire 500 page book, though I'm sure it wouldn't hurt. You could always try Zed Shaw's the-hard-way book on the subject: http://regex.learncodethehardway.org/book/ (haven't read it but the the-hard-way books seem to be fairly well regarded)

I do take issue with your suggestion that you might not use this stuff all that frequently in your career. This is definitely at odds with my experience. Even though I don't use them that much in final-quality code, I use them all the time from the text editor, and quite often for quick one-off text manipulation or extraction scripts. Having a quick way to extract text from ad-hoc data can quickly get you a rough answer to a speculative question, the text equivalent of of back-of-the-envelope calculation, without needing to do a lot of work and without needing the question to justify a lot of work.

But I mainly use them for searching for one of two or three different strings in the text editor.


You don't need to read 500 pages to understand the core of regex. "The core" means "what you will use 99% of the time". You need 11 minutes: http://www.youtube.com/watch?v=hwDhO1GLb_4


I guess your question is why read a book when you can just learn as you go and as you need to. I didn't read a book, but I probably should have because it took a long time for me to pick up things that would have helped a ton earlier on. For example, I recently learned that you can turn off "greedy" when using .* by adding a ? after it. This was a huge revelation that I would have benefited from day one, ten years prior.


Please have a look at this: http://xkcd.com/1205/.


Yes, hundred times yes. Even rudimentary web coding involves regexps somehow. But the real benefit is mastering a topic that is complex and the sense of accomplishment and competency it brings you.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: