if you would have studied the regex guide carefully, you would have known that the first character in the regex pattern is used as delimiter for the pattern i.e. it serves as boundary for your regex string.
look at your regex... the first character is '<'. so it is being used a delimiter for thr regex string.. and now when the regex engine finds the second occurence of the same string (delimiter) it saves the string upto that point as regex and characters next to delimiters are parsed as modifiers for the regex string... in this case a ']' is not a valid modifier.. hence the pretty error message...
changing the regex to following will do away with the error:
Code: Select all
preg_match_all("#<a[\s]+[^>]*?href[\s]?=[\s\"\']*(.*?)[\"\']*.*?>([^<]+|.*?)?<\/a>#",$data,$title_matches);
look how in this case I have defined # as my regex delimiter and it works normally...
in your leisure time be sure to read the
regex syntax on php site.