Click the green flag to start. Game by Leiferde. See original. This game was made in Scratch, an educational programming language. We introduce coding with Scratch in Level 4 if you want to try your hand at making something similar.

Coding the Law
Suffolk Law School: Fall 2022
by @Colarusso

A self-guided LegalTech Adventure for folks with or without prior coding experience.

Regular Expressions (Regex)
13-26 Minutes. Protip: You can watch YouTube videos at more than 1X speed.

FYI, I jump right in to the deep end here, but don't worry, by the time you work through this level you'll have had ample time to play around. Just let this video wash over you. Hopefully, things will start to click about half way through your crossword. ;) Remember, you can always ask for help on Teams.

As discussed above, you should open up Regular Expressions 101: https://regex101.com. Afterward, cut and paste the following text into the TEST STRING field found at regex101, and follow along with the exercise above.

01110100 555.867.5309 01101000 1.4142135623 01101001 987-01-6661 01110011 202.555.9355 00100000 01101001 3.1415926535897932384626433832795 01110011 00100000 666-12-4895 01100001 202-555-9355 00100000 01101000 (555) 867-5309 01101001 01100100 2.718281828459 01100100 01100101 01101110 00100000 01101101 555-867-5309 01100101 01110011 01110011 555/867-5309 01100001 01100111 01100101

FWIW, here's the court case I make use of in the video.

XKCD Comic on regular expressions
Source: Regular Expressions from xkcd.

Optional Media. If you want to learn more about some of the topics discussed in the video above, and you have some free time, you might enjoy the following.

Readings
~ 1 Hour and 34 Minutes

  • Weapons of Math Destruction: Ineligible to Serve (Chapter 6) (17 pages)
  • How Not to Be Wrong: The Baltimore Stockbroker and the Bible Code (chapter 6) and Dead Fish Don't Read Minds (chapter 7) (41 pages)
  • Bestlaw: How a 3L Enhanced Westlaw. A single quote in this article is responsible for its inclusion, "There is an underlying philosophy that the specialist should control their tools, and not the other way around." That philosophy is what we're going for here. ;) (~4 pages)
  • Web scraping doesn’t violate anti-hacking law, appeals court rules. One of the big uses of regex is web scraping. That is, it can be used to search through webpages for specific bits of data. And for a while, whether this is okay has been a bit of an open question. Here's a look at some relevant recent litigation. (~3 pages)
  • Driverless Cars Poised to Undermine War on Drugs. So what is this CFAA referenced in the Ars Technica article above? Well, the answer to that is a bit beyond the scope of this level, but here's a short story I wrote that helps place it in context. Hopefully, this will be a good discussion starter. (~10 pages)

Knowledge Base

Everyone comes to this adventure with a different background. So this section is designed to be a menu of sorts. If you already know a topic well, you can skip the relevant material. Just answer the questions below, and section(s) will disappear accordingly. That being said, if a section doesn't disappear, you should do it. Any time you save skipping a topic, however, should be spent working on your final project or reading ahead in either Weapons of Math Destruction or How Not to Be Wrong. FYI, we will be reading all of Weapons of Math Destruction and all but parts III and V of How Not to Be Wrong.

All of that being said, let's see if we can pare things down.


Can you build a bookmarklet that makes use of regex?



Build A Bookmarklet
Video: ~5-10 Minutes. Protip: You can watch YouTube videos at more than 1X speed.

Here's the bookmarklet creator from the video: https://caiorss.github.io/bookmarklet-maker/

Code for you to copy and paste:

regex = /(\d+) U\.S\.C\. § (\d+)( \(\d{4}\))?/g

replace_str = '<a href="https://www.law.cornell.edu/uscode/text/$1/$2">$1 U.S.C. § $2$3</a>'

document.body.innerHTML = document.body.innerHTML.replace(regex, replace_str);

And here is the court case I used in the video. Once you have made your own bookmarklet from the code above, you can visit that page and see if it works.

Related Tools (Optional): At some point in the future if you don't want to go through the trouble of clicking a bookmarklet, and you're using Firefox, you can write something called a greasemonkey script to just run in the background of every page you visit. For example, I wrote one to hide trending topics on Twitter. To use them you have to install an extension. I'll leave it to you to google more details. Chrome user? Then check out tampermonkey.

Ready to Go?

Before we add to your mission, let's make sure we're on the same page, and don't worry. Your answers to these questions are only saved to this device. It's just a self-test to make sure you know what you need to succeed on your mission. This is by no means an exhaustive test of what you need to know, but if you find yourself missing something, take it as a suggestion to revisit the materials above. If you pared things down based on an answer to the Knowledge Base questions, consider changing the answer and reviewing the material.


Which of the following regex expressions will be able to match all of the phone number in this sentence: 555-555-5555?






Your Mission: Regex Crossword
Video: ~3-5 Minutes. Protip: You can watch YouTube videos at more than 1X speed.
Game Play: 55 Minutes

XKCD Comic: Tech Support Cheat Sheet
Image and Alt Text: Tech Support Cheat Sheet from xkcd.

Here's the game site: https://regexcrossword.com/. Remember to login with your GitHub account. Once you've worked through the Intermediate level, take a screen shot at upload it to your ctl GitHub repo with the name "regex_crossword", the file extension doesn't matter, but .png, .jpg, or .pdf are preferred. Check to make sure that you can see your screenshot at the appropriate URL. For example:

https://[your username].github.io/ctl/regex_crossword.png

Do not limit yourself to the resources provided when working on your crossword (or anything for that matter). Part of what we're trying to do in this class is to acquaint you with nomenclature so that you can efficiently seek out your own solutions. See the Tech Support Cheatsheet flowchart. You know you're looking to understand regex. You know how to Google, embrace this. I've budgeted the time for this such that it assumes you having to do some research while playing. That being said, start with what's at hand. The crossword's Help feature is really helpful. ;)

Your Mission: Citation Finder
Video: ~3-6 Minutes. Protip: You can watch YouTube videos at more than 1X speed.

You can find MassCases here: http://www.masscases.com. This is the example opinion I note above, and here is a link to the Massachusetts General Laws.

Your Final Project
~1 Hour and 30 Minutes

Enrolled students will be presenting on their final project in three weeks. This is the first explicit weekly time carve out for work on your final project. Make it count. See The Final Project Rubric.

Self-Reflection and Logging Your Work
~20 Minutes

As we do at the end of every level, we ask that you take a few minutes to reflect on how things are going. I've also included a set of reading questions to queue things up for our synchronous discussion. Your answers will be shared with me and it will let me know that I can look for any project work you may have posted. That being said, you've almost completed Level 5. Tell me how it's going by completing the form linked below.

Note: Any work you do below, to the extent that it is logged, will be logged in level 6.

Synchronous Meet Up, AKA our Class Time
~1.8 hours | October 3, 2022 @ 4pm Eastern

If you're an enrolled student, we'll be meeting in Sargent Hall Room 325 on Monday October 3rd at 4pm. If you're not an enrolled student, I'm afraid you can't join us.

We will use this time to: (1) work through part II of your challenge; and (2) discuss the readings.

Stretch Goal: Combine the US Code bookmaklet with the one you just made, and add at least one other citation type (i.e., make a citation tool that parses and provides links to citations to the US Code, MA General Laws, and one other publication). If you really want to do something before we meet, you could work on that "other publication" part. ;)

If you are doing the stretch goal, but only if you are doing the stretch goal, post the javascript for your bookmarklet (the original javascript, not the minified version) to GitHub as:

https://[your username].github.io/ctl/bookmarklet.js

Since you're working on this in class, I'll look for this as part of Level 6's check-in.

Time estimates are just that—estimates. The assumptions used to calculate reading time are as follows: 48 pages is assumed to take roughly an hour to read. When working with non paginated texts, it is assumed that a page is roughly equal to 250 words. Videos assume both 3X and 1X viewing. Estimates for coding are based on past experience. Each level should include about 6 hours and 40 min of work.