text stringlengths 1 81 | start float64 0 10.1k | duration float64 0 24.9 |
|---|---|---|
State machines in order to decide from | 1,372.12 | 4.36 |
left to right whether or not to accept | 1,374.279 | 5.081 |
the user's input like Ma at harbard edu | 1,376.48 | 4.72 |
can we get from the start state so to | 1,379.36 | 4.439 |
speak to an accept state to decide Yep | 1,381.2 | 4.88 |
this was in fact meeting the pattern | 1,383.799 | 4.081 |
well let's propose that this | 1,386.08 | 4.079 |
non-deterministic finite automaton look | 1,387.88 | 4.159 |
like this instead we're going to start | 1,390.159 | 4.201 |
as before in the leftmost start State | 1,392.039 | 4.24 |
and we're going to necessarily consume | 1,394.36 | 3.96 |
one character per this first Edge which | 1,396.279 | 3.561 |
is labeled with a DOT to indicate that | 1,398.32 | 3.28 |
we can consume any one character like | 1,399.84 | 5.199 |
the m in Ma at harvard.edu then we can | 1,401.6 | 4.8 |
spend some time consuming more | 1,405.039 | 4.081 |
characters before the at sign so the a a | 1,406.4 | 6.92 |
l a n then we can consume the at sign | 1,409.12 | 5.96 |
then we can consume at least one more | 1,413.32 | 3.64 |
character because recall that the Rex | 1,415.08 | 4.92 |
has dot plus this time and then we can | 1,416.96 | 5.16 |
consume even more characters if we want | 1,420 | 4.32 |
so if we first consume the H in | 1,422.12 | 7.799 |
harvard.edu that then leaves the a r v a | 1,424.32 | 11.08 |
d and then e du and now here too we're | 1,429.919 | 7.24 |
at the end of the story but we're in an | 1,435.4 | 3.72 |
accept state because that's circle at | 1,437.159 | 4.321 |
the end has two circles total which | 1,439.12 | 4.12 |
means that if the computer if this | 1,441.48 | 4.199 |
function finds itself in that accept | 1,443.24 | 4.16 |
state after reading the entirety of the | 1,445.679 | 5.12 |
user's input it is too in fact a valid | 1,447.4 | 5.72 |
email address if by contrast we had | 1,450.799 | 4.081 |
gotten stuck in one of those other | 1,453.12 | 4.2 |
states unable to follow a transition one | 1,454.88 | 4.48 |
of those edges and therefore unable to | 1,457.32 | 4.32 |
make progress in the user's input from | 1,459.36 | 3.96 |
left to right then we would have to | 1,461.64 | 3.639 |
conclude that that email address is in | 1,463.32 | 4.479 |
fact invalid well how can we go upon | 1,465.279 | 4.481 |
approving this code further let me | 1,467.799 | 3.681 |
propose now that we check not only for a | 1,469.76 | 4.24 |
username and also something after the | 1,471.48 | 4 |
username like a domain name but | 1,474 | 3.64 |
minimally required that the string ends | 1,475.48 | 5.04 |
with edu as well well I think I could do | 1,477.64 | 5.08 |
this fairly straightforward not only do | 1,480.52 | 3.72 |
I want there to be something after the | 1,482.72 | 3.839 |
at sign like the domain like Harvard I | 1,484.24 | 4.72 |
want the whole thing to end with | 1,486.559 | 5.081 |
edu but there's a little bit of danger | 1,488.96 | 5.4 |
here what have I done wrong by | 1,491.64 | 5.08 |
implementing my regular expression now | 1,494.36 | 5.679 |
in this way by using plus | 1,496.72 | 8.12 |
do.edu what could go wrong with this | 1,500.039 | 7.921 |
version uh the dot is dot means | 1,504.84 | 5.16 |
something else in this context where it | 1,507.96 | 3.719 |
means zero or more repetitions of a | 1,510 | 3.36 |
character which is why it will interpret | 1,511.679 | 4.36 |
it differently exactly even though I | 1,513.36 | 5.48 |
mean for it to mean literally edu a | 1,516.039 | 5.24 |
period and then edu unfortunately in the | 1,518.84 | 4.36 |
world of regular Expressions dot means | 1,521.279 | 4.041 |
any character which means that this | 1,523.2 | 5.12 |
string could technically end in a edu or | 1,525.32 | 7.16 |
or bedu or cedu and so forth but that's | 1,528.32 | 7.12 |
not in fact that I want so any instincts | 1,532.48 | 5.04 |
now as to how I could fix this problem | 1,535.44 | 3.68 |
and let me demonstrate the problem more | 1,537.52 | 3.48 |
clearly let me go ahead and run this | 1,539.12 | 3.919 |
code here let me go ahead and type in | 1,541 | 5.159 |
maen harvard.edu and as always this does | 1,543.039 | 5.561 |
in fact work but Watch What Happens here | 1,546.159 | 5.481 |
let me go ahead and do Ma at Harvard and | 1,548.6 | 7 |
then uh M at Harvard question mark edu | 1,551.64 | 6.96 |
enter that too is valid so I could put | 1,555.6 | 4.64 |
any character there and it's still going | 1,558.6 | 3.48 |
to be accepted but I don't want question | 1,560.24 | 4.84 |
mark edu I want edu literally any | 1,562.08 | 5.479 |
instincts then for how we can solve this | 1,565.08 | 4.92 |
problem here how can I get this new | 1,567.559 | 4.761 |
function re. search and a regular | 1,570 | 3.919 |
expression more generally to literally | 1,572.32 | 4.28 |
mean a dot might you think you can use | 1,573.919 | 5.64 |
the uh Escape character the backslash | 1,576.6 | 4.84 |
indeed the so-called Escape character | 1,579.559 | 3.561 |
which we've seen before outside of the | 1,581.44 | 3.08 |
context of regular Expressions when we | 1,583.12 | 4.159 |
talked about new lines back sln was a | 1,584.52 | 4.6 |
way of telling the computer I want a new | 1,587.279 | 3.441 |
line but without actually literally | 1,589.12 | 3.159 |
hitting enter and moving the cursor | 1,590.72 | 3.559 |
yourself and you don't want a literal n | 1,592.279 | 4.361 |
on the screen so back sln was a way to | 1,594.279 | 4.241 |
escape and and convey that you want a | 1,596.64 | 3.68 |
new line it turns out regular | 1,598.52 | 3.44 |
Expressions use a similar technique to | 1,600.32 | 3.959 |
solve this problem here in fact let me | 1,601.96 | 4.4 |
go into my regular expression and before | 1,604.279 | 4.201 |
that final dot let me put a single | 1,606.36 | 4.039 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.