Does anyone know where I can find some simple tutorials on using regular expressions to scan HTML pages? I have been searching around for a long time but I only find tutorials explaining the basics of using preg_match to scan words or sentences but not HTML code.. When I try to use what I learn on HTML code it outputs a blank array :/
Well, firs off, it would be useful if you could post some examples and your current regex so we can try to fix it for you. Besides that, I keep suggesting this tutorial. http://www.phpvideotutorials.com/regex/ I think it's quite good.
http://www.ilovejackdaniels.com/cheat-sheets/regular-expressions-cheat-sheet/ this is a great reference if you want to step your feet into the regular expressions...
thanks for the help I have got the cheat sheets printed next to me while im coding with regex The reason it wasn't working before was I didn't realise I had to escape < > characters
You must have changed something else too, because I've never escaped these characters and never had problems with them.
Hi, Check out the following: http://www.regexbuddy.com/ I am not an affiliate or anything like that. I've just found it useful when building regexp's. You should be able to post in your HTML code and build the regexp on the fly. Oops....just noticed they no longer offer a free trial (they used to), however it's still a very cheap tool for what it does in my opinion.