<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>NewSourceMedia Blog &#187; pattern.</title>
	<atom:link href="http://newsourcemedia.com/blog/tag/pattern/feed/" rel="self" type="application/rss+xml" />
	<link>http://newsourcemedia.com/blog</link>
	<description>Focused on Interactive Design, Development and Marketing</description>
	<lastBuildDate>Wed, 11 Aug 2010 13:56:31 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Flash string search replace using prototype</title>
		<link>http://newsourcemedia.com/blog/flash-string-search-replace-using-prototype/</link>
		<comments>http://newsourcemedia.com/blog/flash-string-search-replace-using-prototype/#comments</comments>
		<pubDate>Sun, 19 Apr 2009 20:04:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Prototypes]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[custom proto type]]></category>
		<category><![CDATA[pattern.]]></category>
		<category><![CDATA[prototype]]></category>
		<category><![CDATA[replace string]]></category>

		<guid isPermaLink="false">http://newsourcemedia.com/blog/?p=497</guid>
		<description><![CDATA[How to preform a string search and replace in flash using actionscript prototype
A prototype to replace a pattern in a string

String.prototype.replace = function&#40;pattern, replacement&#41; &#123;
return this.split&#40;pattern&#41;.join&#40;replacement&#41;;
&#125;

To use the prototype

var str = &#34;hello world&#34;;
var newstr = str.replace&#40;&#34;world&#34;, &#34;Earth&#34;&#41;;
trace&#40;newstr&#41;;

This will output: Hello Earth
Related Posts:PHP replace only first occurrence of a string match.PHP Remove last character from stringSplit() [...]]]></description>
			<content:encoded><![CDATA[<p>How to preform a string search and replace in flash using actionscript prototype<br />
<span id="more-497"></span>A prototype to replace a pattern in a string</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">String</span>.<span style="color: #0066CC;">prototype</span>.<span style="color: #006600;">replace</span> = <span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>pattern, replacement<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
<span style="color: #b1b100;">return</span> <span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">split</span><span style="color: #66cc66;">&#40;</span>pattern<span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">join</span><span style="color: #66cc66;">&#40;</span>replacement<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>To use the prototype</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> str = <span style="color: #ff0000;">&quot;hello world&quot;</span>;
<span style="color: #000000; font-weight: bold;">var</span> newstr = str.<span style="color: #006600;">replace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;world&quot;</span>, <span style="color: #ff0000;">&quot;Earth&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>newstr<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>This will output: Hello Earth</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://newsourcemedia.com/blog/php-replace-only-first-occurrence-of-a-string-match/" rel="bookmark">PHP replace only first occurrence of a string match.</a></li><li><a href="http://newsourcemedia.com/blog/php-remove-last-character/" rel="bookmark">PHP Remove last character from string</a></li><li><a href="http://newsourcemedia.com/blog/split-by-newline-and-return-using-php/" rel="bookmark">Split() by newline and return using PHP</a></li><li><a href="http://newsourcemedia.com/blog/php-strip-remove-white-space-from-end-of-string/" rel="bookmark">PHP strip remove white space from end of string</a></li><li><a href="http://newsourcemedia.com/blog/flash-as3-onenterframe-event-changed/" rel="bookmark">Flash AS3 onEnterFrame event changed</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://newsourcemedia.com/blog/flash-string-search-replace-using-prototype/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP replace only first occurrence of a string match.</title>
		<link>http://newsourcemedia.com/blog/php-replace-only-first-occurrence-of-a-string-match/</link>
		<comments>http://newsourcemedia.com/blog/php-replace-only-first-occurrence-of-a-string-match/#comments</comments>
		<pubDate>Tue, 30 Nov 1999 06:00:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[String Manipulation]]></category>
		<category><![CDATA[functions]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[match ereg_replace]]></category>
		<category><![CDATA[occurrences]]></category>
		<category><![CDATA[pattern.]]></category>
		<category><![CDATA[preg_replace]]></category>
		<category><![CDATA[replace]]></category>
		<category><![CDATA[search]]></category>

		<guid isPermaLink="false">http://newsourcemedia.com/blog/1969/12/31/php-replace-only-first-occurrence-of-a-string-match/</guid>
		<description><![CDATA[How to replace only the first occurrence of a string in php.

Say you wanted to only replace the       first occurrence of a string match instead of all occurrences You would       use php preg_replace function to do the trick.
The code is below:

&#60;?
$var = 'abcdef [...]]]></description>
			<content:encoded><![CDATA[<p>How to replace only the first occurrence of a string in php.</p>
<p><span id="more-172"></span></p>
<p>Say you wanted to only replace the       first occurrence of a string match instead of all occurrences You would       use php preg_replace function to do the trick.</p>
<p>The code is below:<br />
<code><br />
&lt;?<br />
$var = 'abcdef abcdef abcdef';<br />
// pattern, replacement, string, limit<br />
echo preg_replace('/abc/', '123', $var, 1); // outputs '123def abcdef abcdef'<br />
?&gt; </code></p>
<p>Just incase you wanted to still match all occurrences, just use the php       function erag_replace.<br />
The code is below:</p>
<p><code><br />
&lt;?<br />
$var = 'abcdef abcdef abcdef';<br />
// pattern, replacement, string<br />
echo ereg_replace('abc', '123', $var); // outputs '123def 123def 123def'<br />
?&gt; </code></p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://newsourcemedia.com/blog/flash-string-search-replace-using-prototype/" rel="bookmark">Flash string search replace using prototype</a></li><li><a href="http://newsourcemedia.com/blog/php-remove-last-character/" rel="bookmark">PHP Remove last character from string</a></li><li><a href="http://newsourcemedia.com/blog/php-validation-numbers-only-from/" rel="bookmark">PHP Validation Numbers Only From</a></li><li><a href="http://newsourcemedia.com/blog/php-remove-non-alphanumeric-characters/" rel="bookmark">Php Remove Non-Alphanumeric Characters</a></li><li><a href="http://newsourcemedia.com/blog/php-strip-remove-white-space-from-end-of-string/" rel="bookmark">PHP strip remove white space from end of string</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://newsourcemedia.com/blog/php-replace-only-first-occurrence-of-a-string-match/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->