Scooby08 Posted November 13, 2008 Share Posted November 13, 2008 Would anybody happen to know why this: <hr width=$hrwidth size=$hrheight /> works with this: preg_match("/<hr width=(\d*) size=(\d*) \/>/", $input, $match); but this: <hr width=$hrwidth size=$hrheight color=$hrcolor /> does not work with this: preg_match("/<hr width=(\d*) size=(\d*) color=(\d*) \/>/", $input, $match); All I did was add the color attribute and for some reason it will not match up?? Am I missing something here, or did I not supply enough information for this to be answered?? I'm also having a hell of a time understanding preg_match.. Link to comment https://forums.phpfreaks.com/topic/132500-solved-preg_match/ Share on other sites More sharing options...
premiso Posted November 13, 2008 Share Posted November 13, 2008 Probably because the color attribute has a # sign in it, and you are looking for only digits. Link to comment https://forums.phpfreaks.com/topic/132500-solved-preg_match/#findComment-688985 Share on other sites More sharing options...
Scooby08 Posted November 13, 2008 Author Share Posted November 13, 2008 here is the actual code I have as of now: <hr width=100 size=1 color=black /> so that cannot be it.. Link to comment https://forums.phpfreaks.com/topic/132500-solved-preg_match/#findComment-688993 Share on other sites More sharing options...
.josh Posted November 13, 2008 Share Posted November 13, 2008 Right. The regex is looking for digits (numbers) 'black' is not a number. try color=(.*) or color=(a-zA-Z) Link to comment https://forums.phpfreaks.com/topic/132500-solved-preg_match/#findComment-688997 Share on other sites More sharing options...
Scooby08 Posted November 13, 2008 Author Share Posted November 13, 2008 Ahh nice! Worked perfectly.. Link to comment https://forums.phpfreaks.com/topic/132500-solved-preg_match/#findComment-689002 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.