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.
5 Answers
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

- 96,375
- 17
- 202
- 225
-
+1 but even though , I also asked maybe somebody know an interesting resource, I mean with some interesting examples, situation. http://www.regular-expressions.info/ seems a bit complicated for beginners, or maybe I am wrong. – Centurion Aug 16 '10 at 16:49
-
@Vad I think [the tutorial](http://www.regular-expressions.info/tutorial.html) is pretty accessible for beginners. – Artefacto Aug 16 '10 at 16:50
-
Regular-expressions.info is designed _for_ beginners. You're not going to find any resource that breaks it down simpler than that. Just take the time to do their tutorial from start to finish, and you'll have a good grasp of regular expressions. – Lèse majesté Aug 16 '10 at 16:51
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)

- 2,632
- 3
- 21
- 28
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.

- 13,333
- 4
- 38
- 46
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".

- 6,302
- 7
- 32
- 47
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.

- 73,866
- 12
- 100
- 156