text stringlengths 1 81 | start float64 0 10.1k | duration float64 0 24.9 |
|---|---|---|
like we see here wouldn't it be nice if | 3,728.96 | 4.079 |
we could handle that as well well let me | 3,730.799 | 4.48 |
propose that we modify my regular | 3,733.039 | 4.921 |
expression as follows it turns out that | 3,735.279 | 5.52 |
you can group ideas together and you can | 3,737.96 | 5.56 |
not only ask whether or not this pattern | 3,740.799 | 5.721 |
matches or this one using syntax like a | 3,743.52 | 6.319 |
vertical Bar B which means either A or B | 3,746.52 | 5.68 |
you can also group things together and | 3,749.839 | 4.44 |
then apply some other operator to them | 3,752.2 | 4.2 |
as well in fact let me go back to VSS | 3,754.279 | 4.201 |
code here and let me propose that if I | 3,756.4 | 5.639 |
want to tolerate a subdomain like cs50 | 3,758.48 | 6.559 |
that may or may not be there let me go | 3,762.039 | 5.121 |
ahead and change it as follows I could | 3,765.039 | 4.08 |
naively do this if I want to support | 3,767.16 | 4.399 |
subdomains I could say well let's allow | 3,769.119 | 5.401 |
for otherw characters plus and then a | 3,771.559 | 4.921 |
literal Dot and and notice I'll | 3,774.52 | 4 |
highlight in blue here what I've just | 3,776.48 | 4.119 |
added everything else is the same but | 3,778.52 | 5.039 |
I'm now adding room for another sequence | 3,780.599 | 5.52 |
of one or more word characters and then | 3,783.559 | 7 |
a literal dot so this now I think if I | 3,786.119 | 6.841 |
rerun python of validate will work for | 3,790.559 | 6.121 |
maen cs50.h harvard.edu enter | 3,792.96 | 5.76 |
unfortunately does anyone see where this | 3,796.68 | 4.639 |
is going let me rerun python of validate | 3,798.72 | 4.8 |
dopy and type in as I keep doing maen at | 3,801.319 | 4.081 |
harvard.edu which up until now has kept | 3,803.52 | 4.88 |
working despite all of my changes but | 3,805.4 | 6.879 |
now finally I've broken my own email | 3,808.4 | 6.8 |
address so logically what's the solution | 3,812.279 | 4.481 |
here well there's a bunch of ways we | 3,815.2 | 3.32 |
could solve this I could maybe start | 3,816.76 | 3.76 |
using two regular expressions and | 3,818.52 | 4.279 |
support you uh email addresses of the | 3,820.52 | 7.279 |
form username at domain. TLD or username | 3,822.799 | 8.401 |
at subdomain dod. TLD where TLD just | 3,827.799 | 6.24 |
means top level domain like edu or I | 3,831.2 | 4.76 |
could maybe just modify this one cuz I'd | 3,834.039 | 4.481 |
prefer not to have like two uh regular | 3,835.96 | 5.04 |
expressions or one that's twice as big | 3,838.52 | 5.24 |
why don't I just specify to re. search | 3,841 | 5.76 |
that part of this pattern is optional | 3,843.76 | 6.039 |
what was the symbol we saw earlier that | 3,846.76 | 5.079 |
allows you to specify that the thing | 3,849.799 | 5.641 |
before it is technically optional the | 3,851.839 | 5.801 |
straight bar we are using the Straight | 3,855.44 | 3.359 |
bar as | 3,857.64 | 4.199 |
a optional make the opt the argument | 3,858.799 | 5.361 |
optional so we could we could use a | 3,861.839 | 4.801 |
vertical bar and some parth es and say | 3,864.16 | 4.76 |
either there's something here or there's | 3,866.64 | 4.36 |
nothing we could do that in parentheses | 3,868.92 | 3.6 |
but I think there's actually an even | 3,871 | 4.48 |
easier way uh actually is a question | 3,872.52 | 6 |
mark indeed question mark think back to | 3,875.48 | 5.119 |
this summary here of our first set of | 3,878.52 | 5 |
symbols whereby we had not just Dot and | 3,880.599 | 5.281 |
star and plus but also a question mark | 3,883.52 | 4.839 |
which means literally zero or one | 3,885.88 | 4.36 |
repetitions which effectively means | 3,888.359 | 4.841 |
optional it's either there one or it's | 3,890.24 | 6.28 |
not zero now how can I translate to that | 3,893.2 | 5.44 |
to this code here well let me go ahead | 3,896.52 | 5.12 |
and Surround this part of my pattern | 3,898.64 | 5.399 |
with parentheses which doesn't mean I | 3,901.64 | 4.28 |
want literally a parenthesis in the | 3,904.039 | 4.121 |
user's input I just want to group these | 3,905.92 | 4.679 |
characters together and in fact this now | 3,908.16 | 4.199 |
will still work I've only added | 3,910.599 | 3.52 |
parentheses around the new part for the | 3,912.359 | 3.96 |
subdomain let me run python of validate | 3,914.119 | 5.321 |
dopy let me run ma cs50.h harvard.edu | 3,916.319 | 5.921 |
enter that's still valid but to be clear | 3,919.44 | 5.28 |
if I rerun it again for maen harvard.edu | 3,922.24 | 6.559 |
that is still invalid but not if I go in | 3,924.72 | 6.599 |
here and say after the parentheses which | 3,928.799 | 5.641 |
now is one logical unit it's one big | 3,931.319 | 6.121 |
group of ideas together I add a single | 3,934.44 | 6.04 |
question mark there this will now tell | 3,937.44 | 5.56 |
re. search that that whole thing in | 3,940.48 | 5.76 |
parentheses can either be there once or | 3,943 | 6.44 |
be there not at all zero times so what | 3,946.24 | 5.319 |
does this translate into when I run it | 3,949.44 | 4.04 |
well let me go ahead and rerun it with | 3,951.559 | 5.161 |
Ma at cs50.h harvard. you so that the | 3,953.48 | 6.28 |
subdomain is there that works as before | 3,956.72 | 4.72 |
let me clear my screen and run it again | 3,959.76 | 4.64 |
python validate with Ma at harvard.edu | 3,961.44 | 5.639 |
which used to work then broke is are we | 3,964.4 | 5.76 |
back in business now we are that's now | 3,967.079 | 6.28 |
valid again questions now on this | 3,970.16 | 5.639 |
approach where we've use not just the | 3,973.359 | 4.841 |
question mark But the parentheses as | 3,975.799 | 4.48 |
well okay yeah you said he works for | 3,978.2 | 5.079 |
zero or one repetition what if you have | 3,980.279 | 5.921 |
more what if you have more that's okay | 3,983.279 | 6.241 |
that's where you could do star star is | 3,986.2 | 5.72 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.