I want to purchase a regular expressions book centered around PHP. I found this one that looks ok: Friedl - Mastering Regular Expressions but it looks like general information about regular expressions and not PHP.

My question is: Does the syntax for regular expressions translate exactly from one language to another, ie-> PHP? or do I need a PHP regular expressions book?

cheers, Keith


The difference between Regex implementations from one platform to another are very small. A book about Regex for any platform will be 95% correct for you.

Written by Rex M

Thanks Rex! - Will get it

Written by Keith Donegan

Accepted Answer

Definitely buy Mastering Regular Expressions. Don't be put off by the fact that it covers other languages besides PHP. Your real goal is to learn regexes, and no other learning resource, online or dead-tree, is anywhere near as good as that book. The language-specific chapters just cover the syntax, features and peculiarities of each language's regex support. The real meat is in the rest of the book, and it's all useful, no matter what language you work in.

Also, be on the lookout for The Regular Expression Cookbook, by Goyvaerts and Levithan. It's due out May 15, and from what I know of the authors, I expect it to be very good. But get Friedl's book now; the G&L book won't replace Friedl's, but supplement it.

(Disclaimer: I'm not affiliated with the authors, publishers or retailers of those books. The affiliate codes in the Amazon links are for the authors themselves.)

Written by Alan Moore
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki