jjk2 Posted August 29, 2009 Share Posted August 29, 2009 for example getdata('<a href="asdf.com" class="new" title="craa">testing</a>'); how can i do that ? thank you. Quote Link to comment Share on other sites More sharing options...
Garethp Posted August 29, 2009 Share Posted August 29, 2009 preg_match('~<([a-zA-Z]+\s|[a-zA-Z]=(?:"|\')?.+(?:"|\')?)+>(.+)</.+>~', $Text, $M); [code] I just woke up, and I cbf testing it, so not guarantees that it'll work Quote Link to comment Share on other sites More sharing options...
jjk2 Posted August 29, 2009 Author Share Posted August 29, 2009 well i was looking more for library....regex is not reliable. Quote Link to comment Share on other sites More sharing options...
trq Posted August 29, 2009 Share Posted August 29, 2009 well i was looking more for library....regex is not reliable. Regex is not reliable? Since when? You mean, you can't write a reliable pattern? It's all good, I'm not much chop at regex either. Anyway, if I was you I would be using jQuery to get the information you want. Quote Link to comment Share on other sites More sharing options...
f1r3fl3x Posted August 29, 2009 Share Posted August 29, 2009 You can use Simple HTML Dom. It's a DOM selector like jQuery's but for PHP. Quote Link to comment Share on other sites More sharing options...
jjk2 Posted August 29, 2009 Author Share Posted August 29, 2009 well i was looking more for library....regex is not reliable. Regex is not reliable? Since when? You mean, you can't write a reliable pattern? It's all good, I'm not much chop at regex either. Anyway, if I was you I would be using jQuery to get the information you want. there are many variations with html tags, its better to use parser lib than regex. you couldget away with regex but i prefer not to use it. i am looking for a library that will return an array of information including all attributes, text, and element type (a, h1, div)... Quote Link to comment Share on other sites More sharing options...
Mardoxx Posted August 29, 2009 Share Posted August 29, 2009 I'm SURE there's a built in function in PHP to manage DOM Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.