Sami Sami - 10 months ago 57
PHP Question

Preg Match To Get Everything Between Total || and \\n|}

So I want to capture everything between

Total ||
inside a string. Right now my current code looks like this:

preg_match('/(Total ||)(.*?)(\\n)/', $jsonwiki, $competitors);

But my regex fails and returns an empty array and I have no idea why?


i dont know regular expressions well, i just added some escaping

(Total \|\|)(.*?)(\\\\n)

| and \ escaped as they are used in the regular expression engine to mean particular things, so if you want a literal pipe you need \|