Matching certain links
Posted: Sat Aug 29, 2009 1:33 pm
I have a page with many links that look like <a href="linked_page-number.html">Reply</a>
I'm trying to use preg_match_all to match all the occurrences of that link regardless of the page name so I can extract the page name and have all of the page names in an array.
I've tried some expressions but they all seem to fail.
This is the closest thing that I've gotten that doesn't return an error:
/<a href="(\d*)">Reply<\/a>/
EDIT: I found/made one that works
/<a href="[^"]+">Reply<\/a>/
Now I just have to take the array and extract the page names.
I'm trying to use preg_match_all to match all the occurrences of that link regardless of the page name so I can extract the page name and have all of the page names in an array.
I've tried some expressions but they all seem to fail.
This is the closest thing that I've gotten that doesn't return an error:
/<a href="(\d*)">Reply<\/a>/
EDIT: I found/made one that works
/<a href="[^"]+">Reply<\/a>/
Now I just have to take the array and extract the page names.