-Last updated 24-August-2023
Erich Purpur
Research Librarian for Science & Engineering
[email protected]
Brown Science & Engineering Library room I046
I'm a part of a group called research data services and I do these things:
1. Serve as Liaison to various engineering departments
2. Teach workshops and classes (like this one)
3. Help people with research projects
4. Random other things as they come up
Workshop | Date | Time |
---|---|---|
Intro to Python pt 1 | Tuesday 8/29 | 12:00 - 1:30pm |
Intro to Python pt 2 | Tuesday 9/5 | 12:00 - 1:30pm |
Intro to Version Control w/ Git + Github | Wednesday 9/6 | 1:00 - 2:30pm |
Python Data Analysis + Visualization | Tuesday 9/12 | 12:00 - 1:30pm |
Intro to Regular Expressions | Wednesday 9/13 | 1:00 - 2:30pm |
Python and APIs | Tuesday 9/19 | 12:00 - 1:30pm |
Geospatial Data + Mapping in Python | Tuesday 9/26 | 12:00 - 1:30pm |
Python Web Dashboards w/ Streamlit | Tuesday 10/10 | 12:00 - 1:30pm |
A regular expression (shortened as regex or regexp also referred to as rational expression) is a sequence of characters that specifies a search pattern in text. Usually such patterns are used by string-searching algorithms for "find" or "find and replace" operations on strings, or for input validation. It is a technique developed in theoretical computer science and formal language theory.
Regular expressions can be used in most if not all programming languages. They are like a mini-language in themselves. While they can be somewhat difficult to read, with a little practice they are not overly complicated.
Because regular expressions are language agnostic, I have provided examples of how to use them for both Python (regularexpressions.ipynb) and R (regularexpressions.rmd). I am not an R user so I did my best to translate the python examples to R. The regular expressions themselves between the two languages are nearly identical, so you can translate from one language to another. I am sure my R code is not good so please cut me some slack!
ChatGPT has quickly made huge changes to the programming landscape. It is a hugely powerful tool If you use it the right way!. I think it is a somewhat slippery slope of how to advise new programmers to use ChatGPT (or other AI tools) so I will refer to some best practices. My personal opinion is that you should use AI minimally when you are starting. When you have a better grasp of basic fundamentals, then you can include AI and greatly increase your speed. Never accept ChatGPT code verbatim! Always double check it before including it in your workflows. I find existing regular expressions difficult to interpret myself and I think ChatGPT very useful for reverse engineering them.
- Online tool to learn, build, and test regular expressions
Corey Schafer Regular Expressions
Corey Schafer Python re Module
I heavily used these youtube videos to create this workshop. I used these when I was first learning regular expressions. Regular Expressions are not something I use regularly so every time I needd to use them, I refer to these videos. I more or less re-created these youtube tutorials for this workshops because I didn't think I could do any better! These videos are very clearly explained and easy to follow. I highly recommend them.
StackOverflow is a huge user community Q&A type site. Odds are very high that someone has asked your question before, just google something like "how to make scatter plot matlplotlib python". I'm pretty certain a StackOverflow thread will be one of the first few search results