PCRE - I need an explanation...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
evilmonkey
Forum Regular
Posts: 823
Joined: Sun Oct 06, 2002 1:24 pm
Location: Toronto, Canada

PCRE - I need an explanation...

Post by evilmonkey »

Hello. I don't really get the PCRE pattern syntax, even after reading this page (http://ca2.php.net/manual/en/pcre.pattern.syntax.php). Can someone please explain what the syntax does? Too many characters, and it just doesn't make sense. :x :?

Thanks. :)
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Entire books have been written on regular expressions so it's not something that a forum post can cover. Best to search google for 'regular expressions tutorial' and spend as many years as possible reading about them :o
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

It's entirely normal to find regex confusing - it was invented by evil madmen for this very purpose. Regex possibly gets the world record as the language with the most meaning condensed into the smallest space.

This handy tool is very useful for trying out expressions: http://www.weitz.de/regex-coach/#install.
redmonkey
Forum Regular
Posts: 836
Joined: Thu Dec 18, 2003 3:58 pm

Post by redmonkey »

The GPL'd QT sources has a little regex checker in the examples directory. It is not fully featured but it's quick and handy for double checking small snippets.
User avatar
evilmonkey
Forum Regular
Posts: 823
Joined: Sun Oct 06, 2002 1:24 pm
Location: Toronto, Canada

Post by evilmonkey »

Thanks everyone, I'm currently trying out the tool that McGruff suggested...I'll ask if there's anything specific. I thought there'd be a straigh-forward answer...
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

evilmonkey wrote:I thought there'd be a straigh-forward answer...
dont we all wish

:evil:
Post Reply