Jump to content

Alphanumeric Characters


pengu

Recommended Posts

Hi guys.

 

Quick question, couldn't find any examples on php.net.

 

I want to do a check to see if a $variable has alphanumeric characters, if it does not, spit an error at them.

 

<?php				

$team_name = 'hello01';

if (!preg_match('[a-zA-Z0-9]',$team_name))
{
echo "Team Name must contain alphanumeric characters.";
exit();
}
?>

 

This still gives me the error message, can you not use '!' with preg_match?

Link to comment
https://forums.phpfreaks.com/topic/205605-alphanumeric-characters/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.