Welcome Guest, Not a member yet? Register   Sign In
Allow Spaces but not other random characters?
#4

[eluser]Jelmer[/eluser]
Something like this:
Code:
function check_blog_name( $str )
{
    return ( preg_match( '/[^a-z0-9 ]/i', $str ) === 0 );
}

EDIT: that matches anything but a to z, 0 to 9 or spaces (the "i" at the end makes it not care about upper/lowercase), if it finds more then 0 matches that means there are disallowed characters.


Messages In This Thread
Allow Spaces but not other random characters? - by El Forum - 07-26-2010, 06:26 AM
Allow Spaces but not other random characters? - by El Forum - 07-26-2010, 06:37 AM
Allow Spaces but not other random characters? - by El Forum - 07-26-2010, 06:39 AM
Allow Spaces but not other random characters? - by El Forum - 07-26-2010, 06:48 AM
Allow Spaces but not other random characters? - by El Forum - 07-26-2010, 06:48 AM
Allow Spaces but not other random characters? - by El Forum - 07-26-2010, 06:49 AM
Allow Spaces but not other random characters? - by El Forum - 07-26-2010, 11:25 PM



Theme © iAndrew 2016 - Forum software by © MyBB