0

I have found this question asked already but my code is so different from the others that I cannot seem to figure out how to apply what I found to my line of code in order to get it to work. I have tried adding # into the second line after the first set of quotes but cant figure out where the ending # should go or if that's even actually what I should be doing. Here is the code that is throwing the error. Also, not sure if this matters but this was originally an ereg_replace that I am turning to preg_replace since ere was depreciated.

echo preg_replace( 
    "\"><a [\?a-zA-Z0-9\-\.\:\"\=\_ >]+</a>([\t\n]+)<ul"," haschildren\\0",

The error I am seeing on the front end is:

Warning: preg_replace(): Unknown modifier '\'

Any help here would be greatly appreciated.

chris85
  • 23,846
  • 7
  • 34
  • 51
jonneebee
  • 19
  • 1
  • 2
    See this for your current error message: http://stackoverflow.com/q/20705399/3933332 and see this: http://stackoverflow.com/q/15454220/3933332 for the converting of `ereg_replace()` to `preg_replace()`. (Yes you are on the right path by adding delimiters to your regex. The links should help you to get it to work; Otherwise update the question with the new/current code) – Rizier123 Aug 01 '16 at 19:52
  • Did you mean: `preg_replace("/\">]+<\/a>([\t\n]+)
      – Gynteniuxas Aug 01 '16 at 20:01
    • Yes Edvin, that was it! I was not placing the delimiter in the second <\/a> area. I was only focusing on the first part. Thanks so much! – jonneebee Aug 01 '16 at 20:51
    • Hi. If this or any answer has solved your question please consider accepting it by clicking the check-mark. This indicates to the wider community that you've found a solution and gives some reputation to both the answerer and yourself. There is no obligation to do this, though. – Gynteniuxas Aug 24 '16 at 16:47

    0 Answers0