Hi all , can somebody point me to a good regular expression resource (for php if it matters). I am looking now for a book here amazon but don't know which one is better. It would be great to find something simple to understand and a fast and interesting process of learning.
You can start at http://www.regular-expressions.info/
The site also has a list of regular expressions books.
PHP supports several regular expressions variants, but the most important is PCRE (perl-comptabible regular expressions).
The mb_ereg
family, besides supporting several encodings, also supports several variants:
j Java (Sun java.util.regex) u GNU regex g grep c Emacs r Ruby z Perl b POSIX Basic regex d POSIX Extended regex
Mastering Regular Expressions by: Jeffrey E.F. Friedl is considered the bible of Regular Expressions books.
Also, as Artefacto mentioned: http://www.regular-expressions.info/ is a terrific resource with clear and simple explanations.
But the best way to learn is to play with them using a regex tool like Reggy (Mac tool)
Along with http://www.regular-expressions.info, you might find it useful to get an interactive regex editor.
The Regex Coach is a good, light-weight editor.
RegexBuddy is amazing, but costly.
regexpal.com a simple, online tester.
This is the only place I've found an intro to regular expressions that's suitable for beginners. It's part of an online book called "Practical PHP".
These are the only regex books you'll ever need:
Both are great tools for learning regexes in general, but they both have lots of information specific to PHP as well.