This is an archived version of the course. Please find the latest version of the course on the main webpage.

Chapter 1: Regular expressions?

Regular expressions

face Josiah Wang

As you can see, regular expressions are strings specifying a search pattern.

Regular expressions are powerful, as it can present sets of valid strings concisely in a single string pattern.

Regular expressions also allow for very fast searching and matching (compared to manually writing a for loop with if-else statements for example).

You can easily use it to search for and replace text segments. Some text editors even allow you to search for words using regular expressions, for example on Notepad++ on Windows.

Regular expression searching on Notepad++