gregchet Posted July 17, 2006 Share Posted July 17, 2006 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----------[code]$pattern = "/\*\*\*\*\* Hand History for Game ([0-9]*) \*\*\*\*\*\\n25/i";$replacement = "test";preg_replace($pattern, $replacement, $string)[/code]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? :P Quote Link to comment Share on other sites More sharing options...
gregchet Posted July 17, 2006 Author Share Posted July 17, 2006 You can ignore this post. I'm going to go a completely different route with the way the matches are being done. Quote Link to comment Share on other sites More sharing options...
effigy Posted July 17, 2006 Share Posted July 17, 2006 /\*{5} Hand History for Game (\d+) \*{5}\s+25/i\n works fine, unless you need an \r\n. 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.