SWEN-250

Regular Expressions - Introduction

Overview

Regular expressions are a powerful (and sometimes complex) mechanism for identifying patterns in text strings

This assignment requires you to use regular expressions (RegEx) using the standard C++ library regex classes.

In this assignment you will implement some basic regular expressions for searching and matching to provide you with practice in basic concepts

  • You will use a C++ makefile (starter file provided) to build the executable
  • A C++ .h file is provided with the basic class method definitions
  • A set of tests are included to exercise your implemention
  • You will essentially create a C++ regex object and execute either a regex_search or regex_match, depending on what is needed
  • All output will be to the console
Instructions
  1. Create a new folder in your repo named 'regex_intro'
  2. Download the zipfile: regex_starter.zip into your folder
    • Contents of the zipfile are:
    • main.cpp: This is provided to you, and has the unit tests. No need to change this
    • regextests.h: This is provided to you, and has the definitions for the methods you need to implement. No need to change this
    • regextests.cpp: This is contains the skeleton methods that you need to implement. Read the comments to understand what you need to do. Do not change the method names or add new methods. Just implement the requirements.
    • Makefile: This is provided to you, and has the make commands to build the code. No need to change this
    • .gitlab-ci.yml: This is provided to you, the commands to run the CI on the gitlab server. No need to change this
  3. Build the application `regex_intro` using make
  4. Test the code by typing ./regex_intro . This will run the `regex_intro` executable from the command line and run the provided tests.
    • In the output, you will see some tests pass (due to default returns in the skeleton code) and some fail. A summary is printed at the end
  5. Review the code and comments in the .h/.cpp files to understand what you need to implement
  6. Implement the code for the classes and functions described in the requirements to get all the tests to correctly pass
  7. Run the tests frequently, and push your code to gitlab frequently (as you get some of the functions working). Each time you push to gitlab, check the CI results. Remember ... 'incremental development'!
Submission
  • Submit your code to a directory named regex_intro in your git respository.
  • Grading scheme: 30 points

    • Clean build (3)
    • Each test passes (1) x 27 = 27