Welcome Guest, Not a member yet? Register   Sign In
preg_replace function problem
#9

[eluser]theprodigy[/eluser]
not as a fix for the regex, but your replacement string should be:
Code:
<a href="http://google.com">\\1</a>
from PHP's website:
Quote:replacement may contain references of the form \\n or (since PHP 4.0.4) $n, with the latter form being the preferred one. Every such reference will be replaced by the text captured by the n'th parenthesized pattern. n can be from 0 to 99, and \\0 or $0 refers to the text matched by the whole pattern. Opening parentheses are counted from left to right (starting from 1) to obtain the number of the capturing subpattern. To use backslash in replacement, it must be doubled ("\\\\" PHP string).
I'll continue trying to figure out the regex.


Messages In This Thread
preg_replace function problem - by El Forum - 02-16-2010, 11:23 AM
preg_replace function problem - by El Forum - 02-16-2010, 09:28 PM
preg_replace function problem - by El Forum - 02-16-2010, 09:37 PM
preg_replace function problem - by El Forum - 02-16-2010, 09:39 PM
preg_replace function problem - by El Forum - 02-16-2010, 10:26 PM
preg_replace function problem - by El Forum - 02-16-2010, 10:39 PM
preg_replace function problem - by El Forum - 02-16-2010, 10:48 PM
preg_replace function problem - by El Forum - 02-16-2010, 10:54 PM
preg_replace function problem - by El Forum - 02-16-2010, 11:21 PM
preg_replace function problem - by El Forum - 02-16-2010, 11:35 PM
preg_replace function problem - by El Forum - 02-17-2010, 12:18 AM
preg_replace function problem - by El Forum - 02-17-2010, 12:22 AM
preg_replace function problem - by El Forum - 02-17-2010, 12:35 AM
preg_replace function problem - by El Forum - 02-17-2010, 12:54 AM
preg_replace function problem - by El Forum - 02-17-2010, 01:52 AM



Theme © iAndrew 2016 - Forum software by © MyBB