Workshop: Regular Expressions are our friends

Summary

Regular expressions are our friends – they also could become your friend, really! They’re neither evil nor do they hurt humans. They require good care, occasional petting and a bit of grooming – but are easy to deal with besides that. Join Kai as he covers pattern matching basics, RegExp syntax, different RegExp engines’ styles and more advanced topics like backtracking, lookaheads, lookbehinds, assertions and much more.

Next workshops

Nothing scheduled – get in touch if you’re interested.

All the details

What the h*ll is this:

/^([a-zA-Z0-9._%+-]+@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,4})(, ?([a-zA-Z0-9._%+-]+@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,4}))*?$/

Or this?

/^([A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA)$/

But that’s easy – right?

/^([0-9]{5}(-[0-9]{4})?|[A-Z]\d[A-Z]((\s|\-)?\d[A-Z]\d)?)$/i

WTF?

/^\/\^?([^\/]|\\\/)+\$?\/([gimsx]{0,5})?$/

Those are regular expressions. Regular expressions are our friends. They’re neither evil nor do they hurt humans. The require good care, occasional petting and a bit of grooming – but are easy to deal with besides that.

Quite a few people have some sort of a rough idea what regular expressions do, what they’re useful for and why really every developer should at least have an idea of using RegExps (as care-takers call them). For web developers regular expressions could be used everywhere: form field data validation (either on the client with JavaScript or Flash/Flex or on pretty much any backend from CF via PHP to Java or Ruby), text pattern recognition, URL rewrite rules with Apache or IIS and many more.

A lot of poeple constantly work with regular expressions on a trial-and-error basis and are not quite happy about the results themselves. But well, what else can one do – it seems there are no training courses and who wants to read the complete O’Reilly book on Regular Expressions – it has a few hundred pages after all.

After this workshop you will have a very good grasp of regular expressions and how to use them correctly.

Topics covered will be:

Morning (Introduction)

  • The different flavours of RegExps (PERL, POSIX etc) and their applications
  • Introducing different test and development environments
  • Character matching
  • Character Sets
  • Metacharacters
  • Repetition and Position Matching

Afternoon (Intermediate to Advanced)

  • Regular Expressions from a formal & structural point of view
  • Regular Expressions <-> context-free grammars and finite state machines
  • The internals of RegExps engines
  • Dealing with subexpressions
  • Backreferences / Backtracking
  • Look-ahead and Look-behind

{ 0 comments… add one now }

Leave a Comment