Tip:
Highlight text to annotate it
X
Welcome back.
In our last exciting episode we learned about regular expressions,
a concise notation as a way to write down or denote or match a number of strings.
This 4 through 7 in brackets corresponds to 4 different strings 4, 5, 6, and 7.
We learned to write more complicated regular expressions like this one--
"b a +."--this plus means one or more copies of a's,
yielding words like ba, baa, baaa, and eventually yielding my sheep.
I assert that it's a sheep. You can tell because of the label. Those labels never lie.
We also learned how you can use regular expressions in Python by importing,
bring in, the functions and data types from the regular expression library.
An example of such a function was findall, which, given a sort of needle regular expression,
would return all of the places in the haystack that it matched.
We also learned that you could turn regular expressions into finite state machines.
This finite state machine accepts the same language as our ba, baa, baaa
regular expression from above.
Starting in a start state, on a b we transition to the middle state,
on an a we end up in the third state, which is an accepting state.
You can tell by the double circle. Then there's a self loop back.
That was last time.