Regex Exercises
Exercise 1
Find words that start with “ex” for the following:
exactly
radiation
table
explosive
exposed
decade
ministry
excluding
expected
suffering
excitement
Story
Exercise 2
Find the SIDs for the following:
Name: Oski, Year: ???, SID: 123456789
Name: Leon, Year: Senior, SID: 382049283 (this is just something random)
Name: Peter, Year: Junior, SID: 329840020 (also something random)
Exercise 3
Find the API keys for the following:
Leon’s API key: uy3829hoipufhp9w8aanoi (don’t use)
Peter’s API key: 489qp3nfshfSsphf09HWan
Eric’s API key: DEMO_KEY he used this in lecture!
Exercise 4
Find the years in the following table:
| Year | value |
| - - - | - - - |
| 1956 | 135436132 |
| 2001 | 86435233 |
| 2008 | 1368543 |
| 2077 | 168463213 |
Exercise 5
Find the links including the parentheses for the following:
Survey and RCT Data
Slides:(https://docs.google.com/presentation/d/1WrouKjnDDaEQTiuXLtEToMqzG8Kt4D2fXNiw3OpFLCM/edit?usp=sharing)
Video: (https://kaltura.berkeley.edu/media/ECON+148%2C+LEC+001+%28Spring+2023%29/1_v7mxpk3x/288222162)
Exercise 6
Find the links not including the parentheses for the following:
Survey and RCT Data
Slides:(https://docs.google.com/presentation/d/1WrouKjnDDaEQTiuXLtEToMqzG8Kt4D2fXNiw3OpFLCM/edit?usp=sharing)
Video: (https://kaltura.berkeley.edu/media/ECON+148%2C+LEC+001+%28Spring+2023%29/1_v7mxpk3x/288222162)
Exercise 7
Find the base URL for the following (e.g. https://docs.google.com)
https://docs.google.com/presentation/d/1WrouKjnDDaEQTiuXLtEToMqzG8Kt4D2fXNiw3OpFLCM
https://kaltura.berkeley.edu/media/ECON+148%2C+LEC+001+%28Spring+2023%29/1_v7mxpk3x/288222162
Reference Solution
Click here to display solution
- Ex1: ex\w*
- Ex2: \d*
- Ex3: API key: (.*)\s
- Ex4: \s(\d{4})\s
- Ex5: \(.*\)
- Ex6: \((.*)\)
- Ex7: https:\/\/.+?\/