954,587 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article
liamfriel
Junior Poster
103 posts since Oct 2009
Reputation Points: 13
Solved Threads: 13
 
<?php
$subject = "<a href='google.com'>Google link</a>";
$pattern = "/url|link|href/";

preg_match($pattern, substr($subject,3), $matches, PREG_OFFSET_CAPTURE);
print_r($matches);
?>
vibhaJ
Posting Shark
931 posts since Apr 2010
Reputation Points: 161
Solved Threads: 183
 

You need to escape the bracket, because it is a reserved char in a regex.

preg_match("/\[url|\[link|<a href/i", $v)
pritaeas
Posting Expert
Moderator
5,484 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
 

Thank you very much it is now working as expected.

liamfriel
Junior Poster
103 posts since Oct 2009
Reputation Points: 13
Solved Threads: 13
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: