<?xml version='1.0' encoding='UTF-8'?>
<rss version='2.0'>
	<channel>
		<title>cotonti.com : preg_replace questions</title>
		<link>https://www.cotonti.com</link>
		<description>Last topic posts</description>
		<generator>Cotonti</generator>
		<language>en</language>
		<pubDate>Mon, 06 Apr 2026 14:23:30 -0000</pubDate>

		<item>
			<title>fade2k</title>
			<description><![CDATA[<p>
	Thank you &amp; Thanks for the link!</p>
<p>
	Your probably right about the @ sign -- Got use to a pesky !bot =0D</p>
<p>
	I'm slowly getting ahang of this stuff =0)</p>
]]></description>
			<pubDate>Tue, 19 Jun 2012 21:56:55 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/forums?m=posts&q=6978&d=0#post34728]]></link>
		</item>
		<item>
			<title>GHengeveld</title>
			<description><![CDATA[<p>
	I think what you're looking for is something like this:</p>
<pre class="brush:php;">
$var = preg_replace('/!([^\s])/', '&lt;a href="https://www.cotonti.com/index.php?e=users&amp;m=details&amp;u=$1"&gt;$1&lt;/a&gt;', $var);</pre>
<p>
	A helpful tool to check your regular expressions is here: <a href="http://gskinner.com/RegExr/" rel="nofollow">http://gskinner.com/RegExr/</a></p>
<p>
	By the way, don't you think the @ sign is more appropriate (considering Twitter's usage of this).</p>
]]></description>
			<pubDate>Mon, 18 Jun 2012 20:59:18 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/forums?m=posts&q=6978&d=0#post34723]]></link>
		</item>
		<item>
			<title>fade2k</title>
			<description><![CDATA[<p>
	I'm my oddball quest to learn PHP, I've been working on simple applications (what better way to learn right?). So I find myself using preg_replace to convert usernames into links in posts using preg_replace. My hangup so far has been the whole regex .. I get it .. sort-of.</p>
<pre class="brush:php;">
$var = preg_replace('/[!]+('.$value.')/',$shoutLink,$var); // $var = a post</pre>
<p>
	The shoutlink is just a link to the members profile. Anyway, it works if the !username is on the first line of the input but when there are new lines without a space afterwords and another !username -- both fail to be replaced with the link. What gives? Does preg_replace see new lines as part of the input (\n!username) or does it ignore it?</p>
<p>
	LoL thanks ahead of time.</p>
]]></description>
			<pubDate>Mon, 18 Jun 2012 15:56:40 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/forums?m=posts&q=6978&d=0#post34722]]></link>
		</item>
	</channel>
</rss>