Wednesday, 4 April 2018

Andre expressions php lecture- 14

hey guys were going on is to keep and in this lecture, we're going to be using a
regular expressions as part of a stem out just head up this Lecture is going
to be more advanced so i'm going to be moving a lot faster than you visual
so go and review this rage expressions(Dallas Website Development) cheese seater which my other very Andre expressions if you're not very fa miliar whether before watching this
video i was going had and get started so in this video we're going to be an
out I am a website which is an anomaly database and it's going to be using a
website called as one one dotcom to how struggle expressions against the
strength to make sure where matching them correctly and i've also decided to
have all the code to because otherwise would take many hours to show this
video so just to keep things short time was going to be explaining what
always called means so the first thing i like to do when matching a constant
from a website like this is to identify does sir reach stream from wish to
to match the content from so the sea al here is just showing a bunch of
movies that were released in the year or two thousand and i'm starting my
surgeon page one so you have all these elements like the title the year in
description director and stars and boats and draws and the image name so
we're going to be imagine all this content now the problem is here i'm going
to be using brain which all function which means we're going to be match and
all the elements at the same time now if i go to the later page for example
page seventy six is going to be a miss in a lot of that content so that
makes it a little bit more tricky because we can just match all the elements
individually we're going to have to measure block of elements for example
here we're going to have to match the moving on time genre and the eye
mediating at the same time and and check if any of those elements or empty
and if they are which is going to set the area value to an empty string so
let's look at the code now and all this is going to make sense hopefully so
first thing i'm doing is i'm loading up their ~~~~~~~ seventy six of the
surgeries walls and a story everything inside the result variable i'm also
creating a new era do these make and i'm just making in a [NOISE] so the
first matches i mention a movie title so this is a regular expression here
and i'm going to go ahead and piece that i go expression inside the right so
I aging and die and a search for this little string here inside of the
search results for our page source going to go a place source and I'm
going to search for that so since we're all in the last be here [COUGH]
seventy say this and who are matching this part of the regime it's shown

fifty results which means all the movies the photo movies that are showing
up on the page is you can see is showing up fifty results and this his old
has been mashed fifty times so that means it's a reliable way to match the
an actual title so that's why using this street this regen expression so if i
the place to actually i'm out here you can see that it's in fact capturing
there's a group one which means is going to store inside of our under a tree
one and his capture in the actual bulli tidal so you can see you're under a
the regular expression I have the little text then instead of the tt and this
the number I have a dog star question mark which means is just going to capture
anything so anything that's there is going to capture it at the numbers
going to change that's why have used the regular expression in this way
then I have the regular little text and then I was that you're flying break
here because there is a new line and then up captures everything that's
between the tags inside the basically using the same thing as a dot
starting question mark and captured it using them around records and that
creates the capture of the movie title ~~~~~~~ so another woman have made
sure that they're at your expression of works was actually go had a great are
movies named just to see that the fact matching all the titles and in fact
it is there's fourteen I know this is the ark stars with zero so there's so
elements and it's matching all the titles so now we're ready to Milan to the
next one which is a year and here's a Reagan expression for the year I'm
going to copy that inside the relics engine

No comments:

Post a Comment