text stringlengths 1 81 | start float64 0 10.1k | duration float64 0 24.9 |
|---|---|---|
then a space then any other character | 4,897.04 | 5.24 |
one or more times and then that is it | 4,899.159 | 5.04 |
and I'm going to pass in the name | 4,902.28 | 5.16 |
variable as before now when we've used | 4,904.199 | 7.04 |
re. search in the past we really used it | 4,907.44 | 6 |
just to answer a question does the | 4,911.239 | 5.241 |
user's input match the following pattern | 4,913.44 | 6.68 |
or not true or false effectively but re. | 4,916.48 | 5.64 |
search is actually more powerful than | 4,920.12 | 4.16 |
that you can actually get back more | 4,922.12 | 4.88 |
information and you can do this you can | 4,924.28 | 4.56 |
specify a variable and then an | 4,927 | 4.159 |
assignment operator and get back more | 4,928.84 | 5.04 |
precise answers to what has been found | 4,931.159 | 5.08 |
when searched for but what is it you | 4,933.88 | 4.6 |
want to get back well it turns out | 4,936.239 | 4 |
there's this other feature of regular | 4,938.48 | 3.88 |
Expressions which allow you to use | 4,940.239 | 4.521 |
parentheses not just to group things | 4,942.36 | 5.4 |
together but to capture them it turns | 4,944.76 | 5.68 |
out when you specify parentheses in a | 4,947.76 | 4.959 |
regular expression unbeknownst to us up | 4,950.44 | 4.6 |
until now everything in the parentheses | 4,952.719 | 5.761 |
will be returned to you as a return | 4,955.04 | 6.599 |
value from the re. search function it's | 4,958.48 | 5.88 |
going to allow you to extract specific | 4,961.639 | 5.161 |
amounts of information from the user's | 4,964.36 | 4.44 |
own input you can reverse this process | 4,966.8 | 4.879 |
too by using the non-capturing version | 4,968.8 | 4.96 |
as well you can use parentheses and then | 4,971.679 | 4.121 |
literally a Mark and a colon and then | 4,973.76 | 3.6 |
some other stuff and that will say don't | 4,975.8 | 3.08 |
bother capturing this I just want to | 4,977.36 | 3.2 |
group things but for now we're going to | 4,978.88 | 4.2 |
use just the parentheses themselves so | 4,980.56 | 3.92 |
how am I going to do this well if I want | 4,983.08 | 4.559 |
to get back the user's last name and | 4,984.48 | 5.8 |
first name I think what I want to | 4,987.639 | 7.681 |
capture is the plus here and the plus | 4,990.28 | 7.879 |
here so I've deliberately surrounded in | 4,995.32 | 5.399 |
parentheses the dot plus both to the | 4,998.159 | 4.401 |
left and the right of the comma not | 5,000.719 | 3.44 |
because I'm grouping them together per | 5,002.56 | 3.48 |
se I'm not adding a question mark I'm | 5,004.159 | 4.48 |
not adding up another Plus or a star I'm | 5,006.04 | 5.639 |
using parentheses now for capturing | 5,008.639 | 5.641 |
purposes why well I'm going to do this | 5,011.679 | 4.721 |
next I'm going to still ask a Boolean | 5,014.28 | 5 |
question like if there are matches then | 5,016.4 | 6.12 |
do this so if matches is not effectively | 5,019.28 | 7.439 |
false like none I do expect I've gotten | 5,022.52 | 6.04 |
back some matches and watch what I can | 5,026.719 | 6.281 |
do now I can do last comma first equals | 5,028.56 | 6.56 |
whatever matches in and get back all of | 5,033 | 4.76 |
the groups of matches then go ahead and | 5,035.12 | 4.16 |
update name just like before with a | 5,037.76 | 4.919 |
format string and do first and then last | 5,039.28 | 5.48 |
in curly braces as well and then at the | 5,042.679 | 3.96 |
very bottom just like before print out | 5,044.76 | 5.919 |
for instance hello comma name so the new | 5,046.639 | 7.401 |
code now is everything highlighted here | 5,050.679 | 6.921 |
I'm using re search to search for | 5,054.04 | 5.8 |
whether the user typed their name in | 5,057.6 | 5.039 |
last comma first format but I am more | 5,059.84 | 6.04 |
powerfully using re . search to capture | 5,062.639 | 5.481 |
some of the user's input what's going to | 5,065.88 | 4.44 |
get captured anything I surround it in | 5,068.12 | 5.039 |
parentheses will be returned to me as | 5,070.32 | 5.44 |
return values how do you get at those | 5,073.159 | 4.801 |
return values you ask the variable to | 5,075.76 | 4.2 |
which you assigned them for all of the | 5,077.96 | 4.48 |
groups all of the groups of parentheses | 5,079.96 | 5.04 |
that were captured so let me go ahead | 5,082.44 | 4.6 |
and do this let me go ahead now and run | 5,085 | 5.239 |
python of format. Pi enter and I'm going | 5,087.04 | 6.56 |
to type my name as usual in this case | 5,090.239 | 6.281 |
nothing happen happens with this if | 5,093.6 | 5.079 |
condition why because I did not type a | 5,096.52 | 6.159 |
comma and so this search does not find a | 5,098.679 | 6.201 |
comma so there are no matches so we | 5,102.679 | 3.881 |
immediately just print out hello name | 5,104.88 | 4.319 |
nothing interesting or new there but if | 5,106.56 | 5 |
I now go ahead and clear my screen and | 5,109.199 | 5.04 |
run python of format. and do maen commas | 5,111.56 | 6.44 |
space David enter we've reformatted my | 5,114.239 | 6.161 |
name well how did this work let me be a | 5,118 | 4.8 |
little more explicit now it turns out I | 5,120.4 | 3.92 |
don't have to just say matches. group | 5,122.8 | 4.28 |
groups I can get specific groups back | 5,124.32 | 5 |
that I want so let me change my code a | 5,127.08 | 5.28 |
little bit more let me go ahead now and | 5,129.32 | 7.04 |
just say this let's update name uh to | 5,132.36 | 6.279 |
well actually let's do this let's say | 5,136.36 | 5.44 |
that the last name is going to be in the | 5,138.639 | 6 |
matches but specifically group one the | 5,141.8 | 4.839 |
first name is going to be in the matches | 5,144.639 | 3.881 |
but specifically group two why one and | 5,146.639 | 3.921 |
two because this is the first set of | 5,148.52 | 4.199 |
parentheses to the left of the comma | 5,150.56 | 3.92 |
this is the second set of parentheses to | 5,152.719 | 3.761 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.