<?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; characters</title>
	<atom:link href="http://newsourcemedia.com/blog/tag/characters/feed/" rel="self" type="application/rss+xml" />
	<link>http://newsourcemedia.com/blog</link>
	<description>Focused on Interactive Design, Development and Marketing</description>
	<lastBuildDate>Mon, 07 May 2012 01:26:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Php Remove Non-Alphanumeric Characters</title>
		<link>http://newsourcemedia.com/blog/php-remove-non-alphanumeric-characters/</link>
		<comments>http://newsourcemedia.com/blog/php-remove-non-alphanumeric-characters/#comments</comments>
		<pubDate>Thu, 28 Dec 2006 00:22:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[String Manipulation]]></category>
		<category><![CDATA[characters]]></category>
		<category><![CDATA[delete]]></category>
		<category><![CDATA[non-alphanumeric]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[preg match]]></category>
		<category><![CDATA[strip]]></category>

		<guid isPermaLink="false">http://newsourcemedia.com/blog/2006/12/27/php-remove-non-alphanumeric-characters/</guid>
		<description><![CDATA[How to strip all symbols and numbers from a string of alphanumeric text. This php code will help you delete, remove, strip and erase any non-alphanumeric characters, and then return the data without the unwanted characters. Need help removing un-wanted &#8230; <a href="http://newsourcemedia.com/blog/php-remove-non-alphanumeric-characters/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[How to strip all symbols and numbers from a string  of alphanumeric text. This php code will help you delete, remove, strip and erase any non-alphanumeric characters, and then return the data without the unwanted characters.<span id="more-178"></span>

Need help removing un-wanted characters from your php text form strings. Here's how to  strip a string of all symbols and characters other than alphanumeric letters and numbers from your file or database. This code will delete any non-alphanumeric characters specified between the brackets, and then output/return the clean version.
<h2>The code</h2>
<code><span style="color: #000000;">
<span style="color: #0000bb;">&lt;?php</span></span></code>

$string <span style="color: #007700;">= </span><span style="color: #dd0000;">"Here! is some text, and numbers 12345, and symbols !£$%^&amp;"</span><span style="color: #007700;">;</span>

<span style="color: #0000bb;">$new_string </span><span style="color: #007700;">= </span><span style="color: #0000bb;">preg_replace</span><span style="color: #007700;">(</span><span style="color: #dd0000;">"//"</span><span style="color: #007700;">, </span><span style="color: #dd0000;">""</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$string</span><span style="color: #007700;">);</span>

echo <span style="color: #0000bb;">$new_string</span>

?&gt;

The code should return this:

<code><span style="color: #000000;"><span style="color: #969696;">Here is some text and numbers 12345 and symbols</span></span></code>

One more thing. If you don't like to keep the blank white space in your text just reformat the preg_replace by removing the "\s" whitespace character types. This is good for use with user names and passwords. The code would now look something like this:

<code> <span style="color: #000000;"><span style="color: #969696;">Hereissometextandnumbers12345andsymbols</span></span></code>]]></content:encoded>
			<wfw:commentRss>http://newsourcemedia.com/blog/php-remove-non-alphanumeric-characters/feed/</wfw:commentRss>
		<slash:comments>39</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! -->
