- 📚 2016 Notes and Examples
- Regular Expression Video Tutorials
- 🚨 Intro to Regex - ~11 min
- 🚨 Meta-Characters - ~16 min
- 🚨 Character Classes - ~14 min
- 🚨 Capturing Groups - ~13 min
- 🍿 Back References - ~4 min
- 🚨 test() and match() - ~17 min
- 🍿 exec() - ~7 min
- 🚨 split() - ~9 min
- 🍿 replace() - ~19 min
- 📕 Chapter 9: Regular Expressions from Eloquent JavaScript by Marijn Haverbeke.
- 📚 Introducing Regular Expressions: JavaScript and TypeScript by Jörg Krause. (This is the full book! If you prefer this to the videos I recommend chapters 1-3)
- 🔗 JavaScript Regex reference:
test()
,exec()
- 🔗 String:
match()
- 🔗 Splitting with regex:
split()
- 🔗 Replace with regex:
replace()
- transformers.js Tokenizer playground
- OpenAI Tokenizer
split()
+ regex- RiTa.js tokenize() function
Design an exercise around regular expressions. Here are some ideas if you are feeling stuck! (To be clear, just do one thing, and writing code is not required for this assignment!)
-
Experiment with using Regular Expressions in a text editor. What new powers does this unlock in your workflow? Write up a post documenting your experiments. Ideas you can try:
- Write a regular expression to find and remove all HTML tags.
- Find all emails or phone numbers in a document.
- Parse a markdown file and find all headers (h1, h2, h3, etc.).
-
Play an online Regular Expressions game like these two above or share any you find! Write up a post documenting your experience.
- Chop up a text into words using
split()
and rebuild the text as separate<span>
elements that you can interact with individually. Here is an example usingsplit()
from this "word interacator" video. - Create a programmatic version of the algorithm you developed for the constrained writing exercise.
- The Flesch Index is a "reading level" score for a passage in English. Here is a p5 sketch that calculates the Flesch Index for a body of text. How could this be improved / changed with regular expressions?
- Create a mad libs generator. For reference here is a video about making Mad Libs with p5.js! (I also made a simpler mad libs example with local CSV file)
- Create a "word replacer" (all words that start with E to words that start with A, all fruits with vegetables, etc.)
- Try generating text with randexp.js + p5.js randexp example.
In preparation for next week, add a link to a data source or API (even just data that appears in raw form on a web page) that interests you! Don't worry about this too much, anything will do! I'll use this list to prepare examples for next week.
- add a link to your API / data source here
- Cara -- Covid19
- Iris --Memes
- Shun --2018 Central Park Squirrel Census Fur Color Map
- Seun -- Libraries in NYC
- Iris -- Memes
- Shun -- 2018 Central Park Squirrel Census Fur Color Map
- Wallis -- WordNet
- Joyce -- Google Maps Javascript API
- Lejing -- wordsapi
- Michal -- Books API
- Lening --The LaMa (Large Mask Inpainting)
- Caroline -- [A Benchmark Dataset for Learning to Intervene in Online Hate Speech https://github.com/jing-qian/A-Benchmark-Dataset-for-Learning-to-Intervene-in-Online-Hate-Speech]
- Zhiyang Free Dictionary
(Please note you are welcome to post under a pseudonym and/or password protect your published assignment. For NYU blogs, privacy options are covered in the NYU Wordpress Knowledge Base. Finally, if you prefer not to post your assignment at all here, you may email the submission.)
- Name -- [assignment title](assignment url)
- Cara -- Week 2 - regex
- Zhiyang Wang -- Complex your sentences-V-2.0.0
- Shun -- Week 2
- Joyce -- Week 2 - regex_replace_cat_with_dog
- Seun Elemo -- Punctuations are important! (Regex)
- LovelyA72 -- Week2
- Lening -- Poem Generator
- Sean -- Regex Playground from A to Z
- Wallis -- Organize downloads
- Lejing -- regex
- Iris --Week2
- Michal -- a small adjustment
- Caroline -- Finding Addresses
- Weber -- Flesch Regex
- 🚨 Watch this video tutorial! (this is technical info needed for the examples). Of course if you alreaddy know this material, you can skip.
- 🔢 This is found in a group, maybe pick just one to check out!
- 🍿 Additional video if you have a particular interest and want to do a deeper dive.
- 📕 Required reading! Let's make sure we all have read this.
- 📚 Optional additional reading for a deeper dive.
- 💻 Code examples here!
- 🔗 Extra reference material / link