1

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 :)

2
  • 4
    Great resource: regular-expressions.info (second hit on Google, right after the Wikipedia entry) Commented Aug 6, 2011 at 13:29
  • +1 for the question. Finally somebody is asking where to start! @Felix Kling: Yeah that site is worth the visit. Commented Aug 6, 2011 at 13:40

2 Answers 2

4

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

Sign up to request clarification or add additional context in comments.

Comments

1

Pascal Martin already pointed to some useful online resources. If you're looking for a book, I can suggest Mastering Regular Expressions.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.