karlmarsh05 Posted December 22, 2011 Share Posted December 22, 2011 Hi there, I currently use a script that collects some contents from a div box, in this case it collects categories with the links still attached. The problem is that the script ends abruptly if the character ' is within the text it is collecting (e.g. phone's). Is there a way of adding the character to the following code so that it does not recognise the character as an official php character. //### Function to remove anything we don't need, and apply the Ebay URL to the href's function removeStr($val,$numbers,$listed) { $val = preg_replace(array('/<\/span\>/','/<\/li>/','/<span class="cnt">/','/href="/'),array('','','','href="http://stores.ebay.co.uk'),$val); Thanks for any help. Karl Quote Link to comment Share on other sites More sharing options...
Psycho Posted December 22, 2011 Share Posted December 22, 2011 Although I see problems in what that regex is doing, I don't think your problem is with the regex. I think the problem is with HOW you are getting the content for $val before calling the function. I can run that preg_replace on values with single and double quotes without error. 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.