I'm trying to do what I thought would be a simple regex replacement, but no matter what I try it doesn't seem to want to work.
I'm trying to do a regex search for the below text (which is part of the $string variable):
** Hand History for Game 1111111111 **
25 NL
$pattern = "/\*\*\*\*\* Hand History for Game ([0-9]*) \*\*\*\*\*\\n25/i";
$replacement = "test";
preg_replace($pattern, $replacement, $string)
1) As soon as I move the "25" up a line so that it's right after the last * on the previous line, and then remove the "\n" from the regex search it works fine, which is how I know it's a newline issue.
2) As suggested by other information I've found online (including php.net), I've tried "\n", "\\n", and "\\n" in the regex search, but none of them work.
Does anyone have any suggestions before I pull the rest of my hair out? 😛