Skip to content

Latest commit

 

History

History
54 lines (38 loc) · 2.28 KB

README.md

File metadata and controls

54 lines (38 loc) · 2.28 KB

Introduction to Regular Expressions

Materials for an entry-level regex course

Introduction

Do you often work with lots of data files on the computer? Are you often trying to spot particular files or lines of text in them that are important for you?

If so, then using regular expressions could save you a lot of time and frustration!

Regular expressions (regex/REs) are a method for describing patterns of characters that you want to match in a body of text. A knowledge of regular expressions can be extremely helpful in computational biology and when combined with text editors and common tools (grep, sed, awk, etc) used in command line computing.

These course materials are designed to give an introduction to using regular regular expressions. Working through the materials, you will learn how to quickly find and replace text in large files, controlling the types and numbers of characters matched, handling repeats, keeping certain parts of a matched pattern during replacement, and constructing sets of different options to be matched.

The course does not provide a comprehensive overview of the regex syntax or engine. Instead, they reflect the vast majority of use cases that the authors encounter. The background of the authors is represented in many of the examples chosen, which often focus on biological contexts and file formats.

For a comprehensive overview of regular expressions, we highly recommend the excellent regular-expressions.info.

Contents

  1. Introduction
  2. Regex Fundamentals
  3. Tokens & Wildcards
  4. Repeats
  5. Capture Groups
  6. Alternative Matching
  7. Links & Recommended Reading
  8. Solutions
  9. Cheats sheet

Files

Download a ZIP of all of the exercise files here.

History

These materials were initially developed by Toby Hodges, Markus Fritz, Supriya Khedkar and Mike L Smith and have been adapted from regex-novice-biology. The have been modified by Festus Nyasimi to suit the training.