EBoard 12: Regular expressions

This class will be recorded! Its use is limited to members of the class. Please do not share with others.

Approximate overview

  • Administrative stuff [~15 min]
  • Q&A [~15 min]
  • Quiz [~10 min]
  • Lab [~50 min]

Administrative stuff

Notes and News

  • Happy National Pancake Day!
    • This advertisement brought to you by IHOP
    • Or at least my vague childhood memories of the IHOP by the Charles
  • Alternately, Happy Fat Tuesday.
    • That seems to go well with the prior celebration.
    • Or perhaps with my identity.
  • I’m still working from home today.
  • Evening tutoring will be available 3-5 p.m. Sundays and 7-10 p.m. Sundays through Thursdays in the tutoring channel on the CS team.
    • If evening tutors + mentor sessions are not enough, we do have individual tutors available.
    • Evening tutors like visitors, including in-person visitors.
  • If you can’t get get @staff to work in the lab channel, feel free to tag all three of us.
  • Office hours generally get booked through https://bit.ly/book-samr.
    • If my office hours are full, you can DM me to set up other times.
    • I prefer to meet with 151 students on Teams. Don’t look for me on Webex.
  • I will attempt to be nicer today. Sorry about yesterday.

The never-ending war with the autograder

  • Sorry for the autograder delay. I wish I could say that things were getting better, but ….
  • You may have to force DrRacket to save your file as plain text.
    • File -> Save Other -> Save Definitions As Text…
    • Then enter the file name.
      • It should be okay to overwrite your file.
  • If there’s an error in your file (e.g., trying to read a text file you haven’t submitted), the check for a variable in that file fails, but only the first time you check.
    • I hate computers.
  • If you reference a text file in your code, you must submit those files.
  • I have discovered that the auto-grader also uses your test cases. Whee!
  • Note: .999 (or something similar) means “all correct”.

Upcoming activities and other token earning things

Events

  • CS Extras, 5pm, Thursday, 18 February, in Events Channel on CS Team. Random Higher-Order Network Generation
  • Get your free food from Chuong Garden Wednesday, Thursday, or Friday. (See note from Dean Marzluff on Announcements Channel.)
    • Yes, you have to write about the experience.
    • If you aren’t on campus, suggest an alternative.
  • Journalism Ethics Workshop, 7:00-8:30 pm, Thursday, March 4 and Tuesday, March 9

Upcoming work

I’m not sure if all of these links are correct. Let me know if any are not.

Attendance

  • Our wonderful mentors will take attendance by looking at the the list of also-wonderful people here.

Notes from the reading responses

People with the name “Jared” often encounter various “alternate spellings” of their name, including “Jered”, “Jerod”, and “Jarod”. Write two regular expressions we could use to match any of those four spellings.

P. YEP

(define jared-like-p
  (rex-any-of (rex-string "Jared")
              (rex-string "Jered")
              (rex-string "Jerod")
              (rex-string "Jarod")))

Q. NOPE

(define jared-like-q
  (rex-concat (rex-string "Jared") 
              (rex-string "Jered")
              (rex-string "Jerod")
              (res-string "Jarod"))

R. TOO GENEROUS

(define jared-like
  (rex-concat (rex-string "J")
              (rex-repeat-0 (rex-any-char))
              (rex-string "r")
              (rex-repeat-0 (rex-any-char))
              (rex-string "d")))

S. BACKWARDS ON THE VOWELS

(define jared-like
  (rex-concat (rex-string "J")
              (rex-char-antiset "aeiou")
              (rex-string "r")
              (rex-char-antiset "aeiou")
              (rex-string "d")))

T. WORKS

(define jared-like-t
  (rex-concat (rex-string "J") 
              (rex-char-set "ae") 
              (rex-string "r") 
              (rex-char-set "eo") 
              (rex-string "d")))
  • Regular expressions are a mechanism for patterns descring patterns in strings.
  • We can use different notations to represent regular expressions.

Notes from early glances at MP2

  • Some folks reject the sample ISBN that ends in zero.
  • Some folks crash on (trim "").
  • For “E”, trim should be concise.
  • Check your file type (see autograder note above; this is not something you should have known about.)

Q&A

Quiz

  • Sam: Remember to talk about the lab before starting the quiz!

Lab

  • New partners!
  • First partner starts the discussion.
  • Introductions / preparation. I mean it.
  • Don’t forget to check the Class Meetings channel from time to time.