NameSilo

Remove irregular characters

Spacemail by SpaceshipSpacemail by Spaceship
Watch
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.

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:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable Domains โ€” AI StorefrontUnstoppable Domains โ€” AI Storefront
Updated the match, forgot to include to allow spaces :red:
 
0
•••
Dynadot โ€” .com TransferDynadot โ€” .com Transfer
CatchedCatched
Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back