From: Xah Lee on
some opinion on regex. I'd be interested to know what others think on
this.

On May 5, 8:51 am, da...(a)adboyd.com (J. David Boyd) wrote:
> Go to O'Reilly, and hunt for books on regular expressions.  It was only
> a few 100 pages, good price, and explained a great deal.

i read the first edition (1997) in 1999.
(see perl book reviews here http://xahlee.org/UnixResource_dir/perlr.html
)

Last i looked, the 3rd edition in 2006, they dropped coverage on emacs
regex.

in general, i don't recommend the book, unless your do regex research.
Regex is useful for matching simple words or phrases. When your need
for pattern match text is slightly more complicated than phrases, such
as computer language source code, regex quickly become not useful.

I've also came across a page that heavily criticize the book, citing
major error, and showing another regex engine that's way more faster.
(i haven't verified it or read it in depth)

http://swtch.com/~rsc/regexp/regexp1.html

quote:
«Finally, any discussion of regular expressions would be incomplete
without mentioning Jeffrey Friedl's book Mastering Regular
Expressions, perhaps the most popular reference among today's
programmers. Friedl's book teaches programmers how best to use today's
regular expression implementations, but not how best to implement
them. What little text it devotes to implementation issues perpetuates
the widespread belief that recursive backtracking is the only way to
simulate an NFA. Friedl makes it clear that he neither understands nor
respects the underlying theory.
»

also, today there's lots tools for text pattern matching. One i
recommend is Parsing Expression Grammar. There are 2 emacs
implementation (on emacswiki.org), but both are hard to use and lack
much documentation. (the “regular expression” we know today since unix
grep of 1990s or earlier, is derived by happenstance from 4 decade old
theory on parsing, based on then so-called theories of so-called
automata)

for your need, i just recommend reading the emacs info page on its
regex in detail.

• Text Pattern Matching in Emacs (emacs regex tutorial)
http://xahlee.org/emacs/emacs_regex.html

• Regular Expressions - GNU Emacs Lisp Reference Manual
http://xahlee.org/elisp/Regular-Expressions.html

for some more opinions on regex, pattern matching, parsing, see:

• Pattern Matching vs Lexical Grammar Specification
http://xahlee.org/cmaci/notation/pattern_matching_vs_pattern_spec.html

Xah
∑ http://xahlee.org/

☄