64x64 icon dark hosting
Choose a hosting plan here and get a free year's subscription to Tuts+ (worth $180).
Advertisement

How to use Lookaheads and Lookbehinds in your Regular Expressions

by
Gift

Start a hosting plan from $3.92/mo and get a free year on Tuts+ (normally $180)

Today, we'll be reviewing the intricacies of regular expressions. More specifically, we'll discuss both how and why you should use positive/negative lookahead ands lookbehinds in your regular expressions. Originally meant to be a quick tip, this screencast ended up a bit longer than expected, at around eighteen minutes.

After viewing the video, keep in mind that, for any given task, there are a plethora of ways to match your desired text. For example, when matching a Twitter username – as we did in the video – you could also use a non-word-boundary, rather than a positive lookbehind.

The key is to find the right tool for the job.


Full Screencast


Advertisement