"Fun" with

Regular Expression

by Lauren Caple & Dan Druliner

Regex

  • Necessary when finding needles in haystacks
     
  • Making sure that .htaccess file only redirects the right URLs
     
  • Adding a little extra logic to find exactly what we're looking for without programming a whole function for it

We all use it

Regex

(even if we don't want to)

Regex

But really, Regex is extremely powerful and useful once you get the hang of it.
 

Especially when you start using it to make your job a little easier...

A necessary evil

Regex as a tool

A lot of applications contain ways to do powerful search and find features.

 

Most modern IDEs also give you the ability to add regular expression to these searches to make them even more powerful.

 

Combining regex with a search and replace function across a whole project/folder can shave a lot of time off of refactoring code.

IDEs making our lives easier

Regex as a tool

It's also possible to create your own scripts with some of these Regex patterns built in

 

Leveraging patterns that come up repeatedly can save you time and give you the ability to automate some of the work you would normally do by hand

Rolling your own

That's nice, but how?

That's nice, but how?

We aren't all "Regexperts", but there are awesome tools online to learn, reference, and test your regex quickly!

 

 

Using even more tools to learn & test

Regex Tools

Regex101.com - testing, highlighting syntax, and reference w/ layman explanations of what your regex is doing. Supports multiple programming languages

 

Regexr.com - testing, highlighting, explanations, and reference for regex with a focus on JS and PHP. You can also share and save!

 

Regexpal.com - similar to the above with a simple interface, ability to share, and a wealth of community posted regex to explore.

 

Useful sites

Regular-Expressions.info - read up on regex, go through a tutorial, and get background info on the syntax

 

30 Useful Regex Code Snippets for Web Developers, all in regex

 

Level up your Regex Game - an article with info on how to up your regex skill and usage in the JavaScript language

 

htaccess tester - test that pesky .htaccess regex!

Show & Tell

Dan will share some real life examples

Questions?

Or share with us how you have used regex to make your life easier.

Lauren Caple - lcaple@uw.edu

 

Dan Druliner - druliner@uw.edu

 

Made with Slides.com