PHP regex patterns
I want to know how regex patterns are written. Where is their base and what do I need to know in order to write patterns. I have absolutely no idea on how to write my own patterns and I am quite in a need of finding a particular match in some of my code.
Is开发者_开发技巧 this some math based subject? Give me all possible information about patterns please :)
I would say you need to read the PCRE Patterns section of the manual -- and, more specificaly, the Pattern Syntax sub-section ;-)
Pretty much everything about PCRE is in there1.
Considering that PCRE are, afterall, Perl-Compatible Regular Expressions, you might also want to read some Perl-related documentation ; for exemple : perlre.
1. Well, once again, the PHP manual is so great, it wasn't possible to not link to it...
Pascal Martin already pointed to some useful online resources. If you're looking for a book, I can suggest Mastering Regular Expressions.
精彩评论