filter tag from contain text with regex

i try filter a text that contain html tags , i want filter <a> tags from inner text of <a> i try


<li><a href='abc'>one</a></li><li><a href='cde'>two tag</a></li><a href='fgh'>tag three</a></li><a href='ijk'>four</a></li>

php :

preg_match_all("/\<a.*?href(?:\=|\s\=)(?:\\"|\')(.*?)(?:\\"|\').*?\>[^\/]*tag\<\/a\>/", $input_lines, $output_array);

result :

0   =>  abc

correct answer is like below

0   =>  cde,
1   =>  fgh

what is wrong and how can get correct result


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s