in reply to book vs. web for Perl Regex study?
As you get your feet wetter in this business, you’ll find yourself fairly constantly dealing with the same sort of challenges ... ripping apart the contents of a file, looking for certain things. That’s why the Unix environment (in particular) has so many tools that specialize in this ... grep, sed, awk, and of course, Perl itself.
(As we know, Perl came to be, because a guy named Larry Wall decided that awk was not quite what he wanted, and he was itching to write a language-based tool and he knew how to do it. The reason for his working with awk in the first place was ... yep, you guessed it. Lots of text files with important things in them. Perl developed its initial “buzz” partly because so many other programmers are always in the very same boat.)
In my experience, the biggest hurdle that stands in the way of comprehension is a regex’s visually baffling syntax. It looks like “a nest of chicken-scratches,” and it basically is. And yet, regexes follow a very well thought-out syntax ... it’s just a syntax that happens to be composed of punctuation marks, not words. Regexes probably do not look like anything that you have seen before, but once you understand just a few principles of this “language,” you will recognize for yourself just how powerful and useful they really are.
Now that you have discovered this bridge ... cross it now. You will be glad that you did. You will use this facility, in various guises, throughout your career ... and you will save bucketfuls of your own time in so doing. Regular expressions are a “core competency” with many very practical benefits. What would otherwise be very nasty subprograms ... hard to write and even harder to debug ... are regular expressions, instead. (“W00T!! W00T!!”)
There are lots of tutorials out there, including some (e.g. hosted by W3C) which let you type in a regex string and try it, right there on the spot. You see, most programming languages these days (including JavaScript) support regular expressions ... and let the record show that they usually describe their implementation as being “Perl compatible.” Perl’s implementation is the one that they elected to follow ... imitation in this case being a sincere form of flattery.
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: book vs. web for Perl Regex study?
by FloydATC (Deacon) on Sep 03, 2010 at 22:22 UTC |