Regular expressions are a concept and an implementation used in many different programming environments for sophisticated pattern matching.They are an incredibly powerful tool that can amplify your capacity to find, manage, and transform data and files.
Of course there are other csv and ods files that we don’t want to collect.
Now we need a way of specifiying a block of letters. So we go backwards from the end of the line collecting all the characters until we hit a character that isn’t a lower or upper case letter. We now actually have all the tools to complete the task.
When you finish, split your team into two groups and write each other some tests.
These should include a) strings you want the other team to write regex for and b) regular expressions you want the other team to work out what they would match. If you want to check your logic use regex101, myregexp, regex pal or regexper.com: the first three help you see what text your regular expression will match, the latter visualises the workflow of a regular expression.
That notation is called “escaping” the special character.
The concept of “escaping” special characters is shared across a variety of computational settings, including markdown and Hypertext Markup Language (HTML).
Some programs, notably many UNIX command line programs (for more on UNIX see our ‘Shell Lesson’), use an older regex standard (called ‘POSIX regular expressions’) which is less feature-rich and uses different metacharacters than Perl-influenced implementations.
For the purposes of our lesson, you don’t need to worry too much about all this, but if you want to follow up on this see this detailed engine comparison.
The parentheses specify a group and the pipe means “or”.
Now, we could search for files ending in a certain extension or another extension. Using the pipe Now we don’t have to write surrounding expressions more than once.