RSS ? Recent Blog Posts

Blogs ยป Archive for September 26th, 2006

The Joy of Regular Expressions [1]

by Harry Fuecks

Was asked recently if I knew of any good regular expressions tutorials (preferably in PHP). The question came from someone certainly smart enough to “get” regular expressions but they’d been unable to find accessible help.

Most regular expression tutorials I’ve seen are organised around teaching the syntax incrementally, which can quickly lead to mental overload. Examples commonly revolve around strings like ‘aaabbababa’…” – great if you’re writing a web crawler for Swedish pop, but confusing for anyone else. And while there are copy and paste regular expressions on-line, if you don’t know what you’re doing, using them can be worse than not at all. Do they meet your needs? Whoops! Mind the security hole…

So going to take a crack at Yet Another Regular Expressions tutorial, with a focus on doing (in PHP) while slowly introducing you to regexp (shorthand for regular expression) syntax. This is going to span a few blog posts (will keep the contents below updated) and get progressively “more interesting” – not all for beginners but if you keep up, hopefully you’ll be able to grasp it. And although it’s “Regexes and PHP”, the regex syntax I’ll be using is largely portable to other programming languages.

Contents

Part …

 

Sponsored Links

SitePoint Marketplace

Buy and sell Websites, templates, domain names, hosting, graphics and more.

Follow SitePoint on...