text stringlengths 1 81 | start float64 0 10.1k | duration float64 0 24.9 |
|---|---|---|
this search re. search is the name of | 695.279 | 5.441 |
the function in the re module that | 698.639 | 4.121 |
allows you to pass in a few arguments | 700.72 | 3.96 |
the first is going to be a pattern that | 702.76 | 4.48 |
you want to search for in for instance a | 704.68 | 5.12 |
string that came from a user the string | 707.24 | 4.24 |
argument here is going to be the actual | 709.8 | 3.039 |
string that you want to search for that | 711.48 | 2.84 |
pattern and then there's a third | 712.839 | 3.12 |
argument optionally that's a whole bunch | 714.32 | 4.28 |
of flags a flag in general is like a a | 715.959 | 4.641 |
parameter you can can pass in to modify | 718.6 | 3.28 |
the behavior of the function but | 720.6 | 2.64 |
initially we're not even going to use | 721.88 | 2.759 |
this we're just going to pass in a | 723.24 | 4.08 |
couple of arguments instead so let me go | 724.639 | 6.161 |
ahead and employ this re Library this | 727.32 | 5.84 |
regular expression library and just | 730.8 | 4.56 |
improve on this design incrementally so | 733.16 | 3.44 |
we're not going to solve this problem | 735.36 | 2.919 |
all at once but we'll take some | 736.6 | 3.679 |
incremental steps I'm going to go back | 738.279 | 4.321 |
to VSS code here and I'm going to go | 740.279 | 4.281 |
ahead now and get rid of most of this | 742.6 | 3.96 |
code but I'm going to go into the top of | 744.56 | 4.92 |
my file and first and all import this re | 746.56 | 5.2 |
Library so import re gives me access to | 749.48 | 4.359 |
that function and more now after I've | 751.76 | 3.72 |
gotten the user's input in the same way | 753.839 | 3.641 |
as before stripping off any leading or | 755.48 | 3.88 |
trailing whitespace I'm just going to | 757.48 | 4.2 |
use this function super trivially for | 759.36 | 4.159 |
now even though this isn't really a big | 761.68 | 5.04 |
step forward I'm going to say if re. | 763.519 | 6.921 |
search contains quote unquote at in the | 766.72 | 5.72 |
email address then let's go ahead and | 770.44 | 4.24 |
print valid else let's go ahead and | 772.44 | 4.6 |
print invalid at the moment this is | 774.68 | 4.56 |
really no better than my very first | 777.04 | 4.239 |
version where I was just asking python | 779.24 | 5.599 |
if at sign in the email address but now | 781.279 | 5.081 |
I'm at least beginning to use this | 784.839 | 3.961 |
Library by using its own re. search | 786.36 | 4.479 |
function which for now you can assume | 788.8 | 5.479 |
returns a a True Value effectively if | 790.839 | 6.041 |
indeed the at sign is an email just to | 794.279 | 4.481 |
make sure that this version does work as | 796.88 | 3.56 |
I expect let me go ahead and run python | 798.76 | 4.28 |
of validate dopy and enter I'll type in | 800.44 | 5 |
my actual email address and we're back | 803.04 | 4.64 |
in business but of course this is not | 805.44 | 4.16 |
great because if I similar Lally run | 807.68 | 3.48 |
this version of the program and just | 809.6 | 3.76 |
type in an at sign not an email address | 811.16 | 3.919 |
and yet my code of course thinks it is | 813.36 | 4.68 |
valid so how can I do better than this | 815.079 | 5.56 |
well we need a bit more vocabulary in | 818.04 | 4.4 |
the realm of regular expressions in | 820.639 | 4.281 |
order to be able to express ourselves a | 822.44 | 5 |
little more precisely really the pattern | 824.92 | 4.4 |
I want to ultimately Define is going to | 827.44 | 3.72 |
be something like I want there to be | 829.32 | 4.439 |
something to the left then an at sign | 831.16 | 4.44 |
then something to the right and that | 833.759 | 3.841 |
something to the right should end with | 835.6 | 4 |
edu but should also have something | 837.6 | 4.64 |
before the edu like Harvard or Yale or | 839.6 | 5.4 |
any other school in the US as well well | 842.24 | 4.48 |
how can I go about doing this well it | 845 | 4.32 |
turns out that in the world of regular | 846.72 | 4.679 |
Expressions whether in python or a lot | 849.32 | 3.879 |
of other languages as well there's | 851.399 | 3.481 |
certain symbols that you can use to | 853.199 | 4.08 |
define patterns at the moment I've just | 854.88 | 4.879 |
used literal raw text if I go back to my | 857.279 | 5.12 |
code here this technically qualifies as | 859.759 | 5.561 |
a regular expression I've passed in a | 862.399 | 5.521 |
quoted string inside of which is an at | 865.32 | 4.72 |
sign now that's not a very interesting | 867.92 | 3.839 |
pattern it's just an at sign but it | 870.04 | 3.28 |
turns out that once you have access to | 871.759 | 3.401 |
regular expressions or a library that | 873.32 | 4.079 |
offers that feature you can more | 875.16 | 5.239 |
powerfully express yourself as follows | 877.399 | 4.841 |
let me reveal that the pattern that you | 880.399 | 4.081 |
passed to re. search can take a whole | 882.24 | 4.08 |
bunch of special symbols and here's just | 884.48 | 3.919 |
some of them in the examples we're about | 886.32 | 4.4 |
to see in the patterns we're about to | 888.399 | 4.841 |
Define here are the special symbols you | 890.72 | 4.96 |
can use a single period a DOT to just | 893.24 | 4.599 |
represent any character except a new | 895.68 | 4.399 |
line a blank line so that is to say if I | 897.839 | 3.8 |
don't really care what letters of the | 900.079 | 3.601 |
alphabet are in the user's username I | 901.639 | 3.521 |
just want there to be one or more | 903.68 | 4.2 |
characters uh in the user's name dot | 905.16 | 4.84 |
allows me to express a through z | 907.88 | 4 |
uppercase and lowercase and a bunch of | 910 | 5.16 |
other letters as well star is going to | 911.88 | 5.959 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.