Question
PHP Regular Expressions
I am trying to write a script that searches for image tags
and checks for alt tags within them. I am using preg_match_all to
find all the img tags but i am messing up somewhere on my regular
expression pattern.
I seriously just started learning these expressions days ago so i really do not know what i am doing here. For some reason my current expression: /<img.+\/>./ Doesnt find the next > after finding the first <img tag. It gets like the second or third one. Shouldnt it cut it off after it finds the first >?
In addition, my other expression (for extracgting the src tag doesnt stop after the second quatation. Insead it goes for a few more. /src=\".*\"/ is what i have now.
What do i need to fix so that the results i get back dont include anything after the first > or the second quation mark?
I seriously just started learning these expressions days ago so i really do not know what i am doing here. For some reason my current expression: /<img.+\/>./ Doesnt find the next > after finding the first <img tag. It gets like the second or third one. Shouldnt it cut it off after it finds the first >?
In addition, my other expression (for extracgting the src tag doesnt stop after the second quatation. Insead it goes for a few more. /src=\".*\"/ is what i have now.
What do i need to fix so that the results i get back dont include anything after the first > or the second quation mark?
