#166 in Computers & technology books
Reddit mentions of Mastering Regular Expressions
Sentiment score: 14
Reddit mentions: 25
We found 25 Reddit mentions of Mastering Regular Expressions. Here are the top ones.
Buying options
View on Amazon.comor
- O Reilly Media
Features:
Specs:
Height | 9.19 inches |
Length | 7 inches |
Number of items | 1 |
Weight | 1.89156620796 Pounds |
Width | 1.3 inches |
[edit: Missed a line when I saved; I'm not using vim keys in my browser] I loved this article! I hope you don't mind if I share a story.
I've been in IT professionally for 14 years, and computing for 35 years. I taught myself vim for log analysis, and it's paid off in so many ways that I evangelize about it.
Vim, by itself, is honestly only a bit useful if you give it only a surface examination. You can use Visual Mode (control V, then movement keys) to select blocks of text for removal, cutting, or pasting. However, a copy of Notepad++ will do the same, so at that level, meh. It's admittedly not user friendly at all coming in from the outside.
However, if you're willing to learn some Regex (and I can't recommend Mastering Regular Expressions (Amazon) strongly enough, then that's where vim really shines. I use it for cleaning up data daily, and between a strong understanding of regular expression, visual mode selection, and macros, I've done cleanup of data coming from odd sources in minutes that would have taken hours of work manually.
I'd love to give you a flat recipe on how to do some of what I do, but the thing about vim and data cleanup work is that the data coming at you for analysis is irregular, so your approach must be flexible. You learn the tools, not a recipe or two, and it takes time. I spent weeks in vim before it really clicked.
I spent time first in vimtutor (packaged with vim), and then w/ Mastering Regular Expressions. Once I had at least a rough understanding of :substitute (vim.wikia), that opened a lot of doors, and that's when I dropped using any other editor for raw text.
Here's an example of some of the things I find myself doing. I had a client the other day who had performed a change to an inventory control system that was filled with mistakes; the system has no undo, and the only record she had left (due to continued PEBKAC) was a PDF report she'd run before making things worse. Said PDF had data split across multiple lines, otherwise filled with garbage and oddball white spaces, and also had some duplicate rows within it. I exported it to text.
I needed to trim out all but two different forms of lines, then eliminate duplicates, then join the two altered line elements together into a single delimited line, flipping the last field from a negative to a positive number (or vice versa) which I could then use to make the corrections to her system. The end result was a 20,000 line file, so it was a lot longer before that.
I was able to transform the PDF in about 20 minutes.
Now, I've learned a few languages since, and I very well could have written a tool to do the job for me, however my relationship with massaging text in vim is such that, thanks to undo/redo, and the experience I've built up, it's actually faster for me to manipulate the file in real time than to alter script, execute, examine, adjust script, and repeat. Vim excels at working with large files, so while it's theoretically possible to do the same work in other editors, I've not found one that will handle massive sets of data with the same speed.
One other thought; if you are also willing to learn a little bit of Unix and pipeline, then invoking shell commands opens up a lot more doors, since Unix has massive amounts of tools and scripts available.
I really hope this helps you!
Here's some lighter reading I've liked:
Readable, but more hardcore
Hardware:
Mathy:
Programmy:
Unixy:
Off the wall:
> especially since the model of delegating un-fancy regexes to an NFA is what I thought that PCRE etc. were already doing
I think the prevalence of things like possessive quantifiers suggests this isn't the case. Even if you run simple regular expressions (as in, yes, really "regular") like
(a*)*c
against a string likeaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
, it will take a very long time to execute. If PCRE dropped back to a real NFA, then such behavior wouldn't be observed.To make things even more confusing, PCRE actually has something called an "alternative matching algorithm" exposed as
pcre2_dfa_match
(it's also in PCRE1). It is not actually a DFA, but it uses something called the "DFA algorithm," which was a misunderstanding that has spread to many minds. In particular, the PCRE folks consider their implementation to be an instance of the "NFA algorithm." The actual facts, AFAIK, are that the standard PCRE engine uses backtracking, not NFAs, and the "alternative matching algorithm" uses an actual NFA, not a DFA.Toward the end of this book there is a two page regex to validate email addresses:
https://www.amazon.com/Mastering-Regular-Expressions-Jeffrey-Friedl/dp/0596528124
It's a big hairy subject if you are serious about getting it 100% correct.
https://www.amazon.com/Mastering-Regular-Expressions-Jeffrey-Friedl/dp/0596528124
Was the book referenced on the grid.
I could also recommend
https://www.amazon.com/Masochism-Art-Power-Nick-Mansfield/dp/0275957020
Mastering regular expressions is a really good book for them who seeks to understand how regular expressions can be successfully applied, and also avoiding many of the pitfalls introduced by careless use.
For my day-to-day use it caries few benefits though as I usually only scan source code and a some-what poor regular expression is sufficient.
regular-expression.info have a nice write-up of each flavor.
[1]: https://www.amazon.com/Mastering-Regular-Expressions-Jeffrey-Friedl/dp/0596528124
[2]: https://www.regular-expressions.info/
Mastering Regular Expressions is necessary reading material for anyone who wants to dive deep into regex syntax. Once you're in the murky depths of atomic and lookaround hell, RegexBuddy is a great tool to evaluate your expression real-time.
Don't go too crazy into it though lest you invoke ZA̡͊͠͝LGΌ.
There are a million and one uses for regular expressions:
If that sounds vague it's because it is. Again, regular expressions are a general tool that can be used in countless ways, and this really isn't a topic that can be explained in a paragraph. People have written entire books on the subject, and you aren't going to get a cogent summary in a reddit comment. (Once upon a time I tried to do that -- explain regular expressions in a reddit comment. It was very long, and people seemed to enjoy it, but I don't think I covered even a fraction of what you'd need to know to be able to use REs. And because of reddit's decrepit, shitty system, I have no way of finding that comment ever again because you can only view the last 1000 comments of someone's history and I post a thousand comments every few months, and this was several years ago. End rant.)
My advice if you don't immediately see the power of the RE is to just let it go and go on with your day. You don't have to know everything. Eventually, you will run into some code that solves some task using a regular expression, and at that point you have something concrete to look at. Try writing a solution for the problem without using a RE, and compare it to the solution that does use a RE. Take apart the RE and learn how it works. Then you can compare the two solutions to see which one is better.
Three esxi servers, each with more than one NIC, and one separate vcenter server is a great starting point. This allows you to tune DRS, HA, and even fault tolerance. Once you get that down, you'll want to be able to tune VMs properly to run most effectively in a virtual environment.
I enjoyed reading these books, though some are "dated" now, the contents are still very relevant. They won't get you anywhere in particular by themselves, but when you combine them with the self-teaching nature of sysadmins I've previously described, these will generously add to your toolset.
HA and DRS deepdive
Sed & Awk
Mastering Regular Expressions. I use rubular.com often.
Pro Puppet
Anything by Bruce Schneier is usually worth your time.
Though I no longer administer a large number of Windows machines, I am a huge fan of Mark Minasi. The Server 2003 book was super helpful in building and maintaining Windows Domains.
I have an old edition of the DNS and Bind book kicking around somewhere.
Understanding the Linux Kernel has largely been useful to me when doing anything "close to the kernel". Not a good beginner's book.
I've never used an apache book, but I enjoyed the Varnish book. This definitely helped me.
Of course, these books don't cover everything, and those listed are relevant to my interests so your mileage may vary. You'll never go wrong teaching yourself new skills though!
EDIT: I forgot about the latest book I've read. I used tmux for a little over a year before purchasing a book on it, and it has improved my use of the program.
I would recommend Mastering Regular Expressions for a gentle and accessible introduction to the topic. Seems like this is the primary thing you want.
Sublime also has multiple cursors. This lets you do certain things you would have done with regex interactively and without thinking, so that's another useful thing to know.
Apart from that, just familiarise yourself with all the buttons and toggles on the Find dialog and you should be good!
If you want to try a programming language, I'd recommend Python, as Sublime is very Python-friendly (just open the console and type expressions in, or try writing some simple plugins), and Python has great regex support, so is often used for slicing text up as well.
<Edit:>
For storytelling there is a list of fairy tale tropes that occur in a given order, someone did a paper on it in analysis of Russian fairy tales, but I don't have the time to Google it. The below is more for programming.
</Edit>
Regular expressions: Oriely Mastering Regular Expressions Very useful for pattern matching in text.
http://www.amazon.com/Mastering-Regular-Expressions-Jeffrey-Friedl/dp/0596528124/ref=dp_ob_title_bk
No "Working effectively with legacy code". Which could be titled "Pragmatic testing".
The DDD blue book, ok. But you'd be better served with "Implementing Domain-Driven Design" which was written 10 years later and have a lot less focus on the technical implementation of DDD.
Mastering Regular Expression should be there too.
Not sure how serious you are, but I was inspired to get better at RegEx when someone solved this problem that someone dedicated an entire project to in one line of regex. After a bit of research (not too much, as a lot of people pointed to it), I bought Mastering Regular Expressions. I'm reading it on and off, and about 30% of the way through, but even after a hundred pages or so, I felt so much more comfortable with them. Already applying a lot to solving work problems, and able to read expressions constructed by others much more comfortably. I highly recommend.
Well most peoply I work with don't know them or only know the basics, e.g. that you can match strings of unknown size.
I'd say that you don't really need more than that, though it occasionally is very handy.
Read the Friedl! It's for beginners too and will tell you everything you need to know and more.
I really liked this book https://www.amazon.com/Mastering-Regular-Expressions-Jeffrey-Friedl/dp/0596528124
Senior Level Software Engineer Reading List
Read This First
Fundamentals
Development Theory
Philosophy of Programming
Mentality
Software Engineering Skill Sets
Design
History
Specialist Skills
DevOps Reading List
>> You literally get what you pay for when it comes to books.
I like these:
http://www.amazon.com/gp/offer-listing/1585009709/ref=dp_olp_used?ie=UTF8&amp;condition=used
http://www.amazon.com/gp/offer-listing/0201633612/ref=sr_1_olp_1?ie=UTF8&amp;s=books&amp;qid=1248674286&amp;sr=1-1
http://www.amazon.com/gp/offer-listing/0596528124/ref=sr_1_olp_1?ie=UTF8&amp;s=books&amp;qid=1248674320&amp;sr=1-1
to know regular expression thoroughly I recommend Jeffrey's Mastering Regular Expressions.
The O'Reilly book Mastering Regular Expressions is very complete if you really, really want to know all the gory details of regular expressions.
Welcome. Regex(Regular Expressions) allows you to parse text more efficiently. Mastering Regular Expressions is what you need to look into.
Well, I'm a bit late. But what /u/Liz_Me and /u/robthablob are saying is the same I was taught in NLP classes. DFA (Deterministic Finite Automatons) can be represented as regular expressions and vice versa. I guess you could tokenize without explicitly using either (e.g. split string at whitespace, although I suspect, and please correct me if I'm wrong, that this can also be represented as a DFA). The problem with this approach is that word boundaries don't always match whitespaces (e.g. periods or exclamation marks after last word of sentence). So I'd suggest, if you are working in NLP, that you become very familiar with regular expressions. Not only are they very powerful, but you'll also need to use them for other typical NLP tasks like chunking. Have a look at the chapter dedicated to the topic in Jurafsky and Martin's Speech and Language Processing (one of the standard NLP books) or Mastering Regular Expressions.
pattern.txt
is more of a reference manual not exactly a great introduction. I'm not entirely sure what would be one, though. I can recommend you Mastering regular expressions, but that's not free, and perhaps a bit more than you need ;-)Also: be aware that Vim regular expressions are different from many others! Basic patterns (like this) will work, but some of the more advanced ones are different (like
.*?
being.\{-}
in Vim). Still, once you grasp the idea behind it, it should be easy to port the idea to Vim ;-)Buy Mastering Regular Expression and you'll essentially have the /[A-Z]/i guide for regular expressions.
Mastering Regular Expressions