Northeast PHP 2013

Expresiones regulares con PHP

Joel Lord  · 
PHP

Transcripción

Extracto de la transcripción automática del vídeo realizada por YouTube.

hello welcome everyone to this first session regular session regular session kidding regular expressions by joelle Lord he is from all Ottawa Canada i'm also Canadian I'm Peter McIntyre from Prince Edward Island so I'm one of the organizers were

very glad to have you people there and these sessions of top quality people from around the world basically to give you some training and some specialty in these kind of unique areas of program so please welcome Doyle and have some time and it has said he's

got some time at the end to ask questions whether i'll leave it up to him how he wants to if you want to interrupt what he's doing to answer questions or not in some welcomed well and enjoy your enjoy the show thank you Peter so all right you get this

started yeah so I will try to have a little bit of time at the end if you have any questions if you have a specific regular expression that you're trying to write please don't ask me that we just never any of that but if you have any questions about

the park i'll be more than happy to help you out with that so regular expressions are might use them so first of all I just wanted to make sure and this is meant to be a 101 course so if you do understand those various missions you're probably in honor

of the right place if you don't understand them and you're a bit scared have to look at them you're at the perfect place so a little bit of a little bit about me so like Pierce and I'm from the well actually the Ottawa region in Canada right

across the river so in halle Quebec so that's what i have in French accent we work in French and look the first time I'm giving this talk in English also so please bear with me I'm a co-owner of heart of company we do web applications for small

businesses most in PHP we do a little bit of JavaScript to of course like everyone else yeah and I am also vice president of engineering science supervising most of the developers working I'm also one that usually take charge of the new the juniors that

start at our company and I try to help them with the code I'm a big fan of regular expressions I use them everywhere in my coat and when people look at the the co-pays that we have most of one of the big thing that I I find lacking is that people don't

understand what it means so I've been trying to implement some ways to make them a little bit more readable and how to actually understand the dental and so they're not scared about it so that's uh yeah a little bit about me how this presentation

will go like i said it's meant to be a one-on-one so first part is a little bit boring sorry about that i will try to go to a different metric erectors all those weird science that you've seen regular admissions how they work what it does so soup is

long for that part after that we'll see a little bit more more built like or useful great voice questions like I said this is not a poor sports like specific regular expressions so just go through a few examples and yeah if that's about it and how

to use them in beach obviously because that's why we're here right so a little bit of terminology I'll be using some of the terms like a little bit next I just one make sure everyone understands what I mean so pattern when you're sorry just

okay patterns you still there right I'll figure it out okay patterns when you're using regular expression well something that we call sometime the regular expression sometimes we also called pattern so I allowed be using both so I'm just so you

know also if you're looking at documentation on hdnet you see the word pattern use pretty much everywhere subject is the string that you want to match against I'm hoping that you know whatever regular expression is more or less so it's some string

that you'll use to match some part of a string and the subject is the spring that you want to match and the match well you might have guessed that it's the match so whatever part of the string you know the sore subject that you submit it to the function

the match will be the part that matches the remuneration order pattern right there hope so first thing regular expressions are surrounded by de limiters de limiters can be just about anything well there's a lot of them that you can use once again php.net

has like full extent like all the list and everything I usually use apparent uses I find it more friendly more user readable or less critics they re actually most people use slashes so i'll be using both of them during a presentation so i put some examples

from code that i made so i might use some prank pieces but i try to use reyes lashes you can also use hash lines or yeah like I said a lot of different leaders but I just want to tell you that I might be using both stone so here go we have our first regular

expression so basically it's / followed by a slash so with two de limiters which means well match anything so i just want to show you how I'll show my examples too so the first one which is my you help matches that regular expression I guess it matches

just anything yeah you have a match the quick brown fox jumps over the lazy dog also matches and where it soon will also match so now let's get started with a simple string like we said what I would want to do with a regular expression is matched something

in the spring so in this regular expression I'm trying to match the word blue in a string so i used the letters to surround the regular expression letters BL you e in that order and does it match so yes i have to work blue it matches because obviously

it contains the pattern of letters BL you e and we have the word blueberry does it match it does because it also had two layers BL you e in it and if we try red well it won't match I can't see well it won't match because it doesn't have that

specific pattern of letters in it so that's what the regular expression is so yeah this one wasn't really useful obviously so let's start with metacharacters met the characters are what are used to match some set of characters or kind of like wild

cards basically you want and that's what the the part that gets scared about this regular expression all those signs that you see there metacharacters so we'll start to see a few of them just the basic unit of characters so you had a little bit of

an idea how to use them first one that i will show you is the plus sign so plus i'm placed next to a corrector means match at least one of that director so in the examples that I have as a regular expression VL + ue it asks for be a letter be followed

by at least one help and you any so our first example blue once again it matches which it has at least one L next to the be next one be you eat doesn't match cuz this one doesn't have at least one L so that's your trying to see how it works and

[ ... ]

Nota: se han omitido las otras 3.460 palabras de la transcripción completa para cumplir con las normas de «uso razonable» de YouTube.