Assignment 3: Regular expressions
Regex is an abbreviation of Regular Expression, a well-known tool for matching text patterns. It is usually used to extract information from code, log files and other texts. In regex, a pattern is defined by characters that regex then tries to find/match in a string or text.

Example on a regular expression.
#Reading
(ca: 10 study hours)
#Course literature
DV1466 Read the following:
- A Practical Guide to Ubuntu Linux (3rd edition)
- Part 7 Appendixes
- A Regular Expressions
- Part 7 Appendixes
DV1563 Read the guide under General tip.
#General tip
You have the guide get started with regex. Use it as reference.
Check out the videos starting with “regex-” in the playlist.
Use the website regex101 to test your expressions.
#Exercises & Assignments
(ca: 10 study hours)
#Exercises
Follow the guide get started with awk.
Read in the guide about sed.
#Assignments
Read the instructions and do the lab
sed1
.Do the assignment awk script.
#Extra assignment
- Read the instructions and do the lab
jq
.
#Hand In
(ca: 2 study hours)
When you have completed all assignments above do the following command to publish all code to the student server.
dbwebb publish me
Then on the education platform Canvas do a hand in for assignment 3 with a text containing reflective answers to the questions below.
- Can you think of any use cases for regular expressions?
- Do you feel more comfortable using the terminal, compared to when you started the course?
- Do you feel comfortable with awk?
- Did you try the extra assignments in the lab?
- Describe your problem solving during the assignment.
Your grade on this assignment and points towards the final grade is given based on the following criteria:
Grade | Final grade points | Assignments | Reflective answers | Extra assignments in labs |
---|---|---|---|---|
A | 20 | X | X | X |
C | 15 | X | X OR | X |
E | 10 | X | ||
F | 0 |
As a last text describe what you have done in this assignment and make an argument for the grade you deserve. The grading of your assignment will use this text as the starting point.
#Revision history
- 2019-08-21: (A, lew) First edition.