Can this be solved by using just regex?
Posted
by Lost_in_code
on Stack Overflow
See other posts from Stack Overflow
or by Lost_in_code
Published on 2010-05-05T17:52:49Z
Indexed on
2010/05/05
17:58 UTC
Read the original article
Hit count: 203
I need to convert
$text = 'We had <i>fun</i>. Look at <a href="http://example.com">this photo</a> of Joe'
to
$text = 'We had fun. Take a look at this photo (http://example.com) of Joe'
All HTML tags are to be removed and the href value from <a> tags needs to be added like above.
What would be an efficient way to solve this? Any code snippet would be great.
© Stack Overflow or respective owner