NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming > CODE
Reload this Page Remove irregular characters

CODE This forum is for posting code snippets and example scripts that aren't quite tutorials, but could be useful for others. You may post code snippets and/or completed scripts that you've written and want to share here.

Advanced Search
6 members in live chat ~  


Reply
 
LinkBack Thread Tools
Old 04-05-2011, 05:56 AM THREAD STARTER               #1 (permalink)
 
BillyConnite's Avatar
Join Date: Jul 2005
Location: Coffs H, Australia
Posts: 3,456
BillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond repute
 


Wildlife Parkinson's Disease Parkinson's Disease

Remove irregular characters


Hi all,

Just a small simple snippet to return whether or not irregular characters (anything not on your keyboard) have been used in a string.
????: NamePros.com http://www.namepros.com/code/709703-remove-irregular-characters.html

Very useful for rejecting international characters (Generally from bots, SPAM!). I use it to reduce spam for the registration process in my forum hosting system.

Code:
	function isRegular($string)
	{
		return !preg_match('/[^A-Za-z0-9\s~`!@#$%^&*()-_=+{}:";\'<>?,.\/]/', $string);
	}
Hope someone finds it useful... Thank god for regular expressions.

If there is a more optimized way to match regular characters only, i'd love to know!

-Rhett.
Last edited by BillyConnite; 04-07-2011 at 10:25 PM.
BillyConnite is offline   Reply With Quote
Old 04-07-2011, 10:25 PM THREAD STARTER               #2 (permalink)
 
BillyConnite's Avatar
Join Date: Jul 2005
Location: Coffs H, Australia
Posts: 3,456
BillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond reputeBillyConnite has a reputation beyond repute
 


Wildlife Parkinson's Disease Parkinson's Disease
Updated the match, forgot to include to allow spaces
BillyConnite is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
LENDZ.com, viaVOiP.net and about 100 more circa1850 Domains For Sale - Make Offer 0 12-22-2006 11:51 AM
LENDZ.com, viaVOip.net and about 100 more circa1850 Domains For Sale - Auctions 0 12-22-2006 11:50 AM

 
All times are GMT -7. The time now is 07:39 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger